I was pretty happy with solution to get notifications from Irssi though it had some shortcomings.
A couple of days ago a colleague made me aware of a Perl modules written by another colleague (Anton Berezin) called IPC::Message::Minivan which, it turns out, is perfect for my notification script. Basing the notifications on Minivan combine the speed of using something like Dbus locally (instant notifications) with the convenience of my previous script (notifications over the network, able to handle multiple clients).
This setup consists of three parts: The Minivan daemon, the Irssi script and the notification script.
As always my instructions are based on Ubuntu but should work on most Linux and Unix systems.
Installing the Minivan
IPC::Message::Minivan is not yet available directly through CPAN so we need to install it manually
- Download IPC::Messaging and IPC::Message::Minivan (and unpack them).
- Install dependencies:
sudo apt-get install libjson-xs-perl libregexp-common-perl
- One could use
dh-make-perlbut I chose to install the two modules manually; basically
perl Makefile.pl && sudo make install
- Create an Upstart script for the Minivan daemon in
# minivan - minimalistic message bus # description "minimalistic message bus" start on runlevel  stop on runlevel [!2345] expect fork respawn exec /usr/local/bin/minivan -l /var/log/minivan -d
- Start the Minivan daemon:
$ sudo start minivan
Install the Irssi script
- Copy the script to
- Load the script inside Irssi:
/script load notifier-minivan.pl
- If your Minivan is not running on the same machine as Irssi, change the configuration inside Irssi:
/set minivan\_host your\_hostname- IPC::Message::Minivan is tunnel-able through ssh, see client configuration
- Auto-load the script:
ln -sf ~/.irssi/scripts/notifier-minivan.pl ~/.irssi/scripts/autoload/notifier-minivan.pl
The stuff running on your local machine
It is possible to use autossh to automatically setup the tunnel but since I am always connected to my server (at least when I am in front of a computer) I chose to use normal ssh port forwarding.
~/.ssh/config I have
Host my.server.bogus LocalForward 6826 localhost:6826
The stuff that actually shows the notifications
I did not want to bother trying to make the script error proof so I simply call the Perl script from a shell script like so
Save the script as
The notification script requires Desktop::Notify - It is available in the Ubuntu repositories but it is an old version, so let’s use a newer:
$ sudo apt-get install dh-make-perl libnet-dbus-perl $ cpan2deb Desktop::Notify $ sudo dpkg -i ~/.cpan/libdesktop-notify-perl*.deb
Copy the script to
Remember to make both scripts executable.
The final thing to do is to add the notify client to your desktop environment’s autostart
In GNOME: System -> Preferences -> Startup Applications