Irssi as your IRC client with notification using shnotify.pl

After spending the last years trying many IRC clients, I found that all GUI clients suck. so I decided to use a terminal based client and all recommendations pointed me to use Irssi. It took me around 2 hours to get used to how it works, just some commands and installing some of its scripts got me to do what I want. maybe you will love using it too if you are spending your day in front of terminals or if you just believe that GUI clients aren’t your best choice.

Installing it on Ubuntu wasn’t a problem, just like what you always do

sudo aptitude install irssi

now run irssi in your terminal to start it. now you can connect to any IRC server by typing this

/connect irc.freenode.net

Irssi won’t remember any settings and auto start it till you tell it to do so, and I wanted to make Irssi auto-connect to freenode.net on startup

/SERVER ADD -auto -network freenode irc.freenode.net

also, I didn’t want to type my password every time I connect to this server

/NETWORK ADD -autosendcmd "/msg nickserv identify mypassword;wait 2000" freenode

this will run the IDENTIFY command with my password after connecting to the freenode server and will wait for 2 seconds before doing any thing else.

now I can join any channel the normal IRC way by typing

/join #channelName

and I can jump between my opened channels using CTRL+n and CTRL+p , or by pressing ALT+ window number . if you are using gnome-terminal with many opened tabs, maybe you will have problems with moving between channels using ALT+number as this shortcut is used by gnome-terminal to jump between tabs.

Also, I found some nice scripts for Irssi like
nickcolor.pl , this script will give each user in your opened channels a separate color.

trackbar.pl , this one will put a separator (one line) after the last message appeared in every channel before you leave it.

installing these script is easy, you can put these script in ~/.irssi/scripts/ , then in irssi load them using

/run scriptname.pl

if you like a script and want to auto-load it on start, just create another directory “~/.irssi/scripts/autorun/” and create links in this directory pointing to your scripts that should be auto-loaded.

I wanted Irssi to notify me when anybody mention my name by showing me a notification bubble. I found here a script “mumbles.pl” written be Matthew Weier O’Phinney our Zend Framework warrior. but for my bad luck I didn’t know how to get the mumbles notification server specially as its website is down. so I tried to play with that script to make it show notifications using zenity. you will find the code here, you can create a new file “shnotify.pl” in your ~/.irssi/scripts directory and put that code in it. this will show you a notification bubble whenever your nickname or any other word you tell Irssi to highlight using the /hilight yourword command is mentioned.

use strict;
use Irssi;
use Irssi::Irc;
use vars qw($VERSION %IRSSI);

$VERSION = '0.1.0';
%IRSSI = (
 authors     => "Ahmed Shreef",
 contact     => 'ahmed@shreef.com',
 name        => 'notification bubble for Irssi',
 description => 'This script will show a notificatin bubble near the systray when your nickname is mentioned',
 license     => 'New BSD',
 changed     => "2010-6-9"
);

sub shnotify {
 my ($dest, $text, $stripped) = @_;

 if (($dest->{level} & (MSGLEVEL_HILIGHT|MSGLEVEL_MSGS)) && ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0)
 {
 if ($dest->{level} & MSGLEVEL_PUBLIC)
 {
 my $message = $dest->{target} .": " . $stripped;
 `echo "message:$message" | zenity --notification --listen --window-icon=null`;
 }
 }
}

Irssi::signal_add({
 'print text'    => \&shnotify
});

tell me if you like it or if you need some help.

1 Comment Irssi as your IRC client with notification using shnotify.pl

Leave a Reply

Your email address will not be published. Required fields are marked *