Display notifications with IRSSI

Introduction

Since a few months now, I used irssi as my IRC client. I like it because it is highly configurable and because it’s CLI. However, one thing is a bit annoying about irssi: it has no notifications when somebody talk to me. Either it is some ping on a public chan or a private message, if I don’t check my terminal, I can’t know if somebody needs me.

However, another strength of irssi is that is can be extended with plugins. I will propose an extension to send notification through libnotify.

The plugin

To begin, I only used the plugin proposed by Thorsten Leemhuis called fnotify. On irssi, it is very easy to use a existing plugin. You need to put the Perl file fnotify.pl into your ~/.irssi/scripts/ directory. Note that it seems it must have the .pl extension to be loaded. Once it’s done, you can simply load the plugin into irssi doing the following command in an opened instance of irssi.

/script load fnotify

AUtomatically load the plugin

To load this plugin each time irssi is started, you must copy your plugin into ~/.irssi/scripts/autorun/. You may create a symbolic link too.

ln -s ~/.irssi/scripts/fnotify.pl ~/.irssi/scripts/autorun/fnotify.pl

Modifying the plugin to send notifications

The plugin is only catching the highlights and private message to print them into the file ~/.irssi/fnotify. To send notifications, we will use the libnotify library which provide the notify-send command. To call that command into our Perl script, we will use the system function.

To make it work, you will probably need to install libnotify (which may be there if you’re using Gnome) and Perl (which may be installed with irssi).

You can find the modify script here.

links

social