dammIT

A rantbox by Michiel Scholten

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. Today however, I ran across Irssi GUI Notify, which was exactly what I was looking for. It uses a perl script [download from my server, 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 this package to get the notifications working:

sudo apt-get install libnotify-bin

and of course a 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)