irssi desktop notifications

For IRC, I run irssi inside a screen session on the other side of an ssh connection. This is generally great; it survives laptop reboots (which are much more frequent than server reboots), and it means I can connect to it from anywhere and not lose any state. However, I work from home, and it's useful for my colleagues to be able to contact me reasonably quickly by IRC. I don't want to have to check my IRC client window all the time in order to have a decent response time here. The main thing I envy of folks who use graphical IRC clients is that they usually light up somewhere obvious in their window manager when somebody's requesting attention.

I eventually got fed up, Googled around a bit, and discovered an implementation of desktop notifications for irssi by Thorsten Leemhuis; while I'm not the only person to have published some improvements to this (see the blog comments), here are mine. I made it clean up properly after itself, added a "heartbeat" so that the server process would go away automatically in the event of disconnection, and fixed its character escaping.

The notifications are pulled over ssh, so this doesn't depend on being able to connect back from your server to your desktop or laptop.

Instructions

  1. Grab the fnotify script (original source; this one includes an improvement by Michael Banck to avoid sending notifications for the active window), save it in ~/.irssi/scripts/, and symlink from ~/.irssi/scripts/autorun/. (To load immediately without restarting irssi, run /script load fnotify.)

  2. Install the libnotify-bin package (on Debian or Ubuntu; other distributions can fend for themselves) on the machine where you're running your desktop.

  3. Install the irssi-notify-server script in ~/bin/ on the machine where you're running your IRC client.

  4. Install the irssi-notify script in ~/bin/ on the machine where you're running your desktop. Change your.ssh.host to whatever your IRC client machine is called.

  5. It's a good idea to set up SSH connection sharing to this box, if you haven't already. On my system, I created ~/.ssh/control/ and put this in ~/.ssh/config:

    Host *
            ControlMaster auto
            ControlPath ~/.ssh/control/%h.%p.%r
    

    However, connection sharing can be problematic in some cases, so you might want to limit this to just your IRC client machine (by writing something more specific for Host).

  6. Run irssi-notify & to start the notifier.

I also wrote an extra helper to notify me of new Launchpad bugs that arrive in my Ubuntu bug mailbox. It's a bit hacky, but works so far. The relevant bit of my .procmailrc currently looks like this:

:0:
* ^X-Launchpad-Bug: distribution=ubuntu
{
    :0c:
    | lp-bug-notify-helper

    :0:
    ubuntu/mybugs
}

Beware: at the moment there is no locking on ~/.irssi/fnotify.


This Web page is created and maintained by Colin Watson.
Last modified: $Date: 2008-05-06 16:55:30 +0000 $