dotfiles
dotfiles copied to clipboard
porting
Any tips on porting just your notification system to somewhere else? I quite like it from the gifs I've seen of it, but porting it is a bit of a messy task because it's so tied to everything else and undocumented...
It's not that complicated actually. I'll describe how the notification system works here.
You can bind a notification listener to each corner with bin/bar_notifyd {southeast, northeast, northwest, northeast}
. bin/bar_notifyd
listens to tmp/notify_fifo_$CORNER
. So if you started bin/bar_notifyd southeast
you would send a notification to the south eastern corner by appending your notification to /tmp/notify_fifo_southeast
. By appending I mean just simply echoing to the file: echo test >> /tmp/notify_fifo_southeast
.
So I'm not using freedesktop notifications for my notifications really, so I don't send notification with notify-send
. My .xinitrc
start bin/bar_notifyd northeast
and I've binded different things to use bin/notify-info
which outputs it's input to /tmp/notify_fifo_northeast
. I have binded freedesktop notifications to my notification system with sind
for consistenty.
For formatting the notifications, see the documentation of https://github.com/LemonBoy/bar
bin/bar_notifyd
supports multiline notifications, but I'm pretty sure it currently works with only two lines. You can break the line with ;
.
From reading the code, that's kind of what I figured. I'm confused about a couple things, though:
- What is
bin/notifyd
? Do I need to use it at all? - From the code I figured out that for it to work at all I need to pass the output of
xrandr
into /tmp/xrandr_output (you forgot to specify that part, but I'd already figured it out). Is there a specific reason for that? - Following those steps (plus running
xrandr > /tmp/xrandr_output
) causes bar_notifyd to error with
/home/kahr/Scripts/bar_notifyd: line 68: (normal: missing `)' (error token is "normal")
Which doesn't really make sense, given the code of line 68: position_x=$((monitor_x + monitor_width - pad_x - width))
Am I missing anything?
- What is bin/notifyd? Do I need to use it at all?
bin/notifyd
binds freedesktop notification to use the custom notification system. It starts a bin/bar_notifyd
in the south western cornern and shows freedesktop notifications there. It's replacement for any freedesktop notification manager (notification managers that show notifications sent with notify-send
).
- From the code I figured out that for it to work at all I need to pass the output of xrandr into /tmp/xrandr_output (you forgot to specify that part, but I'd already figured it out). Is there a specific reason for that?
You got that right. I cache xrandr output, since it is pretty slow (on my desktop it takes half a second) and I use the output in many scripts.
- Following those steps (plus running xrandr > /tmp/xrandr_output) causes bar_notifyd to error with /home/kahr/Scripts/bar_notifyd: line 68: (normal: missing `)' (error token is "normal") Which doesn't really make sense, given the code of line 68: position_x=$((monitor_x + monitor_width - pad_x - width))
Those variables are grepped from xrandr output, and I'm guessing that your xrandr output differs from mine and some of those variables are grepped wrong. You could start by debugging those variables.
bin/bar_notifyd
is a real spaghetti now that I look at it, sorry for that. :)
Haha, it's okay. I'll start debugging there then.
I'm surprised xrandr is so slow on your system - on mine it takes about 0.077 seconds to run.