Irssi notification in terminal using ‘write command’

In Desktop Environments like KDE or GNOME, we have special libraries like knotify or libnotify to display notifications from various applications. Some applications like Konversation has its own notification systems. But what about command line tools like Irssi? Imagine you are chatting in tty1 using irssi and doing something in tty2.How will you know if someone has mentioned you nick in channel message? Well, here is a small solution for this.

Luke Macken has written a wonderful  perl script to display notifications using notify-send command in desktop environments. Thanks to open source, I tweaked the call to notify-send command to suit our tty-notification. All that you have to do is this :

Step 1 : Get the Script and write it to a file 'notify.pl'.

Step 2 : Replace

system("notify-send -i gtk-dialog-info -t 5000 '$dest->{target}' '$stripped'");

With

system("echo '$dest->{target}' '$stripped' | write <Your username>");

Make sure you replace <Your username> with your system username.

Step 3 : Put it in ~/.irssi/scripts/ directory.

Step 4 : Execute the following commands in irssi:

/load perl
/script load notify

Done, you will get notification to the latest tty to which you are logged in!
Good luck :)

PS: The notification that you get is not eye-candy, please adjust for it now :)

Leave a Comment