irssi notification script

Like many people in the Ubuntu community, I use a combination of irssi and screen over ssh to access IRC. For a while, I have been using a notification script that displays a notification whenever someone hilights me. This has worked pretty well for letting me quickly see messages that concern me when I am sitting in front of my computer. However, I frequently miss messages if I am not staring at my computer screen, even though I might only be a few feet away from my computer. This is why I have recently, with some help from Johnathon Mlady, modified the script to read my notifications to me. It does this using festival. However, since I keep my computer in my bedroom, I did not want to have it talking to me while I was sleeping. I also knew that if I simply relied on me remembering to hit the ‘mute’ key before going to bed, that I would end up waking up in the middle of the night to a talking computer. This is why I decided to have the script only read my notifications when screen is attached. To use the script, you should start by following Aaron Toponce’s guide, but instead of using the bash script he links to, you will use the following script:

ssh remote-server.net ": > .irssi/fnotify ; tail -f .irssi/fnotify " |
sed -u 's/[&]//g' | while read heading message;
do /usr/bin/notify-send -i notification-message-im -- "${heading}" "${message}";
if [[ -n `ssh remote-server.net screen -list | grep '(Attached)'` ]]; then
echo "${message}" | sed -ur 's/^.*>//' | /usr/bin/festival --tts;
fi
done

Hopefully, some other people will find this script useful.

Advertisements
This entry was posted in Planet Ubuntu. Bookmark the permalink.

One Response to irssi notification script

  1. zazuge says:

    that’s one cool trick ^^
    thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s