add irssi-notify
authorhttps://launchpad.net/~kralph <kralph@web>
Tue, 13 Sep 2011 18:13:22 +0000 (11:13 -0700)
committerKenyon Ralph <kenyon@kenyonralph.com>
Tue, 13 Sep 2011 18:13:22 +0000 (11:13 -0700)
Debian.mdwn

index e2e12b9..b7eae55 100644 (file)
@@ -21,6 +21,33 @@ Dependencies:
 * [[!debpkg perl]]
 * [[!debpkg curl]]
 
+## irssi-notify
+This script is based on <http://extern.tribut.de/irssi-notify> (linked from <http://thorstenl.blogspot.com/2007/01/thls-irssi-notification-script.html?showComment=1174835100000#c1681311296903415398>). It makes notifications on your desktop when you get messages in irssi. I fixed the link handling, added comments to the sed script, and used portable character classes in the regular expressions.
+
+[[!format bash """
+#!/bin/bash
+# Run this script in the background from the machine you want
+# notifications to appear on: irssi-notify &
+
+ssh -f irssi-server "tail --lines=10 $HOME/.irssi/fnotify; > $HOME/.irssi/fnotify; tail --follow $HOME/.irssi/fnotify" |
+    sed --regexp-extended --unbuffered "
+        s/&/\&amp;/g; # replace characters with HTML entities
+        s/</\&lt;/g;
+        s/>/\&gt;/g;
+        s%(#[[:alpha:]]+ )&lt;([^>]{0,10})&gt;%\1<b>\2</b> %g # bold the channel
+        s%(https?://[^ ]+)%<a href=\"\1\">\1</a>%g; # make clickable links
+        s%([\w+-]+@[^ ]+\.[[:alpha:]]{1,3})%<a href=\"mailto:\1\">\1</a>%g;" |
+    while read heading message
+    do
+        notify-send --category=im.received --expire-time 5000 --icon /usr/share/openclipart/png/computer/icons/flat-theme/applications/ksirc.png -- "${heading}" "${message}"
+    done
+"""]]
+
+Dependencies:
+
+* [[!debpkg libnotify-bin]] for notify-send
+* [[!debpkg openclipart-png]] for the icon
+
 ## debconf
 Make it so all questions are asked: `sudo dpkg-reconfigure debconf` and answer lowest priority.