Irssi tips
From awesome
Using IRSSI with Awesome
[edit] Urgent Signals
You can have the awesome window manager identify if somebody sent you a message on IRC using the urgency settings, by doing the following:
In irssi:
/set bell_beeps ON /set beep_msg_level MSGS NOTICES INVITES DCC DCCMSGS HILIGHT
Permanent irssi configuration:
# settings # fe-common/core bell_beeps = "yes"; beep_msg_level = "MSGS NOTICES INVITES DCC DCCMSGS HILIGHT";
In .Xdefaults for terminal emulators:
! rxvt-unicode URxvt.urgentOnBell: true ! xterm XTerm*bellIsUrgent: true
In GNU screen:
Make sure audible bell is enabled (C-a C-g to check). Permanent setting for .screenrc:
vbell off # no visual bell
[edit] Notifications
The following script loaded by irssi will send a message to naughty (using dbus) to show a notification.
##
## Put me in ~/.irssi/scripts/autorun
##
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.02";
%IRSSI = (
authors => 'Donald Ephraim Curtis',
contact => 'dcurtis@cs.uiowa.edu',
name => 'notify.pl',
description => 'notify Awesome WM of irssi message',
license => 'GNU General Public License',
);
sub notify {
my ($title, $text) = @_;
my %replacements = (
'<' => '<',
'>' => '>',
'&' => '&',
'\"' => '"',
'`' => '', # added for security purposes
);
# lazy way of constructing the regexp - I've done enough typing already!
my $replacement_string = join '', keys %replacements;
$title =~ s/([\Q$replacement_string\E])/$replacements{$1}/g;
$text =~ s/([\Q$replacement_string\E])/$replacements{$1}/g;
system("notify-send -t 7500 \"<span color='#ffffff'>".$title."</span>\""." \"".$text."\"");
}
sub highlight {
my ($dest, $msg, $stripped) = @_;
my $window = Irssi::active_win();
if (($dest->{level} & MSGLEVEL_HILIGHT) && ($dest->{level} & MSGLEVEL_PUBLIC)) {
notify($dest->{target}, $stripped);
}
}
sub query {
my ($server, $msg, $nick, $addr) = @_;
my $window = Irssi::active_win();
my $itemwindow = $server->window_find_item($nick);
if ($window->{refnum} != $itemwindow->{refnum}) {
notify($nick, $msg);
}
}
Irssi::signal_add('print text', 'highlight');
Irssi::signal_add('message private', 'query');

