libnotify over ssh
Posted by bene - 15/02/08 at 09:02:36 pmlibnotify is a nice desktop notification framework, very similar to Growl. It’s basically a client-server architecture: the desktop implements a notification-daemon where the clients send notifications to (via D-Bus).
In my case it’s notification-daemon-xfce and on the client side primarily galarm and pidgin (using a patched pidgin-libnotify plugin).
With notify-send you can also create your own notification. I wrote a little zsh wrapper function to get a notification when the command terminates:
# run some command and notify about the result via the notification-daemon
function run () {
$@
local error=$?
if [[ $error -eq 0 ]]; then
notify-send “`hostname -s` | terminated:” “$1 $2″ -i finish -t 0
else
notify-send “`hostname -s` | aborted:” “$1 $2″ -u critical -i undo -t 0
fi
return $error
}
The usage is quite simple:
# run sudo update-eix
All of this is nice but I decided to need notification of remote events as well.
I hate to wait or poll till a command on my server terminates, instead the server should notify me. ![]()
Additionally I run a WeeChat IRC-client 24/7 in screen and want a notification for (private) IRC messages.
Accomplishing my requirements is a tough task, but after some research I found this nice idea of Jared Quinn: libnotify-with-irssi-over-ssh.
The trick is to tunnel the notification through the terminal using the print pipe.
I adapted his scripts and patched them to fit my needs:
My favorite terminal is rxvt-unicode so the .Xdefaults entry looks a bit different:
URxvt.print-pipe: ~/scripts/unmarshal.pl
My unmarshal script collects the content of the pipe and sends the notification to the daemon:
unmarshal.pl (html)
…the WeeChat plugin (based on growl-notify):
…and finally the drop-in replacement for notify-send:
If notify-send is placed in /usr/local/bin/ on the remote host, you can just type something like run sudo updatedb and get a notification to the desk. ![]()
3 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with GimpStyle Theme design by Horacio Bella. Get Entries and comments.
Hrhr, ich erinner mich noch an Zeiten die ich einer WG verbracht hab, da war nicht mal Nulden kochen möglich, ohne dass irgendwo ein galarm tickte
Comment by micele — February 19, 2008 #
[...] Bene shares some modifications he made to my libnotify over ssh post. [...]
Pingback by Jared Quinn » Blog Archive » libnotify over ssh enhanced — June 15, 2008 #
[...] this in several years. Please submit any patches/changes as required. You should also check out foosion’s version of [...]
Pingback by Using irssi with libnotify over Secure Shell | Jared Quinn — November 14, 2009 #