Mon, 14 Aug 2006

irssi notification script

Having finals to deal with next week, I've been trying to avoid things that tend to waste huge amounts of time, such as email and IRC. So I wrote a little irssi script to pop up notifcation bubbles when people talk to you.

*Update (20090916)*

Years later, and I can't really vouch for this code anymore, as I don't use it. I recommend using it at your own risk, as there could potentially be security implications, since it is unmaintained. However, this script was the catalyst for a variety of improved implementations, such as irssi-libnotify, fnotify, irssi-notify, etc.

notify.pl
##
## Put me in ~/.irssi/scripts, and then execute the following in irssi:
##
##       /load perl
##       /script load notify
##

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

$VERSION = "0.01";
%IRSSI = (
    authors     => 'Luke Macken',
    contact     => 'lewk@csh.rit.edu',
    name        => 'notify.pl',
    description => 'TODO',
    license     => 'GNU General Public License',
    url         => 'http://www.csh.rit.edu/~lewk/code/irssi-notify',
);

sub notify {
    my ($dest, $text, $stripped) = @_;
    my $server = $dest->{server};

    return if (!$server || !($dest->{level} & MSGLEVEL_HILIGHT));

    $stripped =~ s/[^a-zA-Z0-9 .,!?\@:\>]//g;
    system("notify-send -i gtk-dialog-info -t 5000 '$dest->{target}' '$stripped'");
}

Irssi::signal_add('print text', 'notify');


posted at: 06:43 | link | Tags: , | 6 comments

irssi notification script

Having finals to deal with next week, I've been trying to avoid things that tend to waste huge amounts of time, such as email and IRC. So I wrote a little irssi script to pop up notifcation bubbles when people talk to you.

*Update (20090916)*

Years later, and I can't really vouch for this code anymore, as I don't use it. I recommend using it at your own risk, as there could potentially be security implications, since it is unmaintained. However, this script was the catalyst for a variety of improved implementations, such as irssi-libnotify, fnotify, irssi-notify, etc.

notify.pl
##
## Put me in ~/.irssi/scripts, and then execute the following in irssi:
##
##       /load perl
##       /script load notify
##

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

$VERSION = "0.01";
%IRSSI = (
    authors     => 'Luke Macken',
    contact     => 'lewk@csh.rit.edu',
    name        => 'notify.pl',
    description => 'TODO',
    license     => 'GNU General Public License',
    url         => 'http://www.csh.rit.edu/~lewk/code/irssi-notify',
);

sub notify {
    my ($dest, $text, $stripped) = @_;
    my $server = $dest->{server};

    return if (!$server || !($dest->{level} & MSGLEVEL_HILIGHT));

    $stripped =~ s/[^a-zA-Z0-9 .,!?\@:\>]//g;
    system("notify-send -i gtk-dialog-info -t 5000 '$dest->{target}' '$stripped'");
}

Irssi::signal_add('print text', 'notify');


posted at: 06:43 | link | Tags: , | 0 comments