I whipped up a quick hack to give me growl alerts for irssi highlighting. It is pretty horrible, gross, and yucky, but it works well enough for me. I thought I'd share in case people don't care so much about how grotesque this is.
On my server running irssi, I wrote this irssi script:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Irssi; | |
use vars qw($VERSION %IRSSI); | |
$VERSION = "0.01"; | |
%IRSSI = ( | |
authors => "Jason May", | |
contact => 'jason.a.may@gmail.com', | |
name => 'alertsfile', | |
description => 'Send all hilight messages to a file for external apps to process', | |
license => "Public Domain", | |
url => "http://irssi.org/", | |
changed => "2002-03-04T22:47+0100" | |
); | |
sub sig_printtext { | |
my ($dest, $text, $stripped) = @_; | |
if (($dest->{level} & (MSGLEVEL_HILIGHT|MSGLEVEL_MSGS)) && | |
($dest->{level} & MSGLEVEL_NOHILIGHT) == 0) { | |
$window = Irssi::window_find_name('hilight'); | |
open my $fh, '>>', "$ENV{HOME}/.growl-alerts"; | |
print $fh "$stripped\n"; | |
close $fh; | |
} | |
} | |
Irssi::signal_add('print text', 'sig_printtext'); |
On my macbook where I get growl messages I wrote this shell script:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BREWBIN=/Users/jasonmay/.brew/bin | |
GROWLHOST=$1 | |
( | |
/usr/bin/ssh "$GROWLHOST" "cat .growl-alerts 2>/dev/null; rm -f .growl-alerts" && echo | |
) | while read msg | |
do | |
# send twice because it doesn't always work the first time... :/ | |
for i in $($BREWBIN/gseq 1 2) | |
do | |
echo "$msg" | ( [ "x$msg" == 'x' ] || $BREWBIN/growlnotify "$GROWLHOST" ) | |
done | |
sleep 10 | |
done |
...and ran it in cron on my macbook:
* * * * * /path/to/growl-alerts.sh myhost.org
No comments:
Post a Comment