Fancy desktop notification for irssi!
A couple of weeks ago, nixternal blogged about notify-send and irssi in Kubuntu. In response to his entry, I read up on the Desktop Notification Specification and learned that notify-send accepts a mixture of html and xml tags. Why not have the nick that pinged you in bold, so that you can better separate it from the message. The script now also displays both brackets around a nickname, instead of just one.
#!/bin/sh
ssh ryan@192.168.1.101 ": > .irssi/fnotify ; tail -f .irssi/fnotify " |
sed -u '/^#/s|\([^ ]* \)<\([^>]*\)>\(.*\)|\1<b>\<\2\></b>\3|;/^[^#]/s|[^ ]*|<b>&</b>|' |
while read header message;
do /usr/bin/notify-send -u critical -c im.received -i \
/usr/share/icons/default.kde/48x48/apps/edu_languages.png -t 200000 -- "$header" "$message";
done;
To use the script, install fnotify.pl on the host running irssi. Then place the shell/libnotify script above in your PATH (make sure to edit it, as described below), run it in screen and detach, and then start a new screen for irssi (ssh to the host running irssi). :
- ryan@192.168.1.101 by the username and host of the computer where irssi is running
- /usr/share/icons/default.kde/48x48/apps/edu_languages.png by the path to your desired icon
I would like to thank Karl Thornton from #sed for helping me with the regex (aka, writing it), and marthmm from ##linux for helping me debug the script.
EDIT: Sorry, wrong link for fnotify.pl . Save fnotify to .irssi/scripts/fnotify.pl on the host running irssi. Anybody needing help can find me as ryanakca on IRC, or comment to this blog entry (Yes, I just fixed the antispam commenting thingy).
Comments: To comment on this post, send me an email following the template below. Your email address will not be posted, unless you choose to include it in the link: field. If your web browser is configured to handle mailto: links, click comment to load the template into your mail client.
To: Ryan Kavanagh <rak@rak.ac> Subject: [blog-comment] /blog/2007-04-29-fancy-desktop-notification-for-irssi/ post_id: /blog/2007-04-29-fancy-desktop-notification-for-irssi/ author: [How should you be identified? Usually your name or "Anonymous"] link: [optional link to your website] Your comments here. Markdown syntax accepted.
0 Comments