Skip to content

Instantly share code, notes, and snippets.

@bavardage
Created May 26, 2009 19:35
Show Gist options
  • Save bavardage/118245 to your computer and use it in GitHub Desktop.
Save bavardage/118245 to your computer and use it in GitHub Desktop.
##
## 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 => '[email protected]',
name => 'notify.pl',
description => 'TODO',
license => 'GNU General Public License',
url => 'http://lewk.org/log/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'");
system("notify-send -i /home/ben/Pictures/irssi_white.png -t 5000 '$dest->{target}' 'You were highlighted' &");
}
Irssi::signal_add('print text', 'notify');
my $bitlbee_channel = "&bitlbee";
my $bitlbee_server_tag = "Bitlbee";
sub bitlbee_message {
my($server, $msg, $nick, $address, $target) = @_;
return if $server->{tag} ne $bitlbee_server_tag;
system("notify-send -i /home/ben/Pictures/irssi_white.png -t 10000 '$server->{tag}' '$nick said something' &");
}
Irssi::signal_add("message private", "bitlbee_message");
#Irssi::signal_add("message public", "bitlbee_message");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment