irssi

updated @ 2007-09-17

Originally posted on dammIT weblog on Sunday 25 March 2007, edited.

Use irssi on your server, get notifications locally

I've been using irssi for quite a while as my primary IRC client, running in a screen session on my server so I'm always online. However, when someone says my nick, I only notice when looking at the terminal it's running in, and it shouldn't have scrolled out of sight yet [when it's in the current channel]. So, a way of notifying me would be cool. Then I came across Irssi GUI Notify, which was exactly what I was looking for. It uses a perl script [download this local copy, and rename to fnotify.pl] in irssi to add lines containing your nick to the file 'fnotify' in your ~/.irssi/ dir. This is then read by a bash script you run locally, which uses a notification daemon to show popup notifications [see the linked pages for screenshots]. The one that works best for me [there are several posted on those weblogs], is this version, taken from this weblog:

#!/bin/bash
ssh user@host ": > .irssi/fnotify ; tail -f .irssi/fnotify " |
sed -u 's/[<@&]//g' | while read heading message;
do /usr/bin/notify-send -u critical -i /usr/share/icons/Tango-xfce/scalable/apps/terminal.svg -t 30000 -- "${heading}" "${message}";
done

Just save it to a convenient place and start it automatically; it'll keep running and monitoring the notifications file. You may want to adjust the 30000 to a timing you like; it's the amount of milliseconds the popup will stay visible. Also, you may want to change the icon path from that terminal icon to something else. You'll need the libnotify-bin package to get the notifications working. To install on a Debian based system [should work on Ubuntu too, for example] do:

sudo apt-get install libnotify-bin

and of course a notification-daemon [e.g., apt-get install notification-daemon]. By default, Irssi only highlights the nick that mentioned your nick if your nick is first on the line. Otherwise, it is not the case. This can be fixed highlighting the nick that mentions your nick anywhere in the text. Do the following in Irssi:

/hilight -nick (your_nick)