Open Source,  Random,  Ubuntu

Irssi OSD notifications

I wanted irssi to ping me using Ubuntu/Gnome’s on screen notification system, but didn’t want to dig into irssi’s code… what is one to do?

Cobble scripts together of course! Here’s how I got it done:

  1. Download this irssi plugin:
    This script will update a text fileĀ  (~/.irssi/fnotify) with a new line every time you are pinged
  2. Put in ~/.irssi/scripts
  3. autorun this script by executing:
    ln -s ~/.irssi/scripts/ ~/.irssi/scripts/autorun/
  4. start irssi, and run:
    /hilight -nick {your_nick}
  5. When someone pings you, check the ~/.irssi/fnotify file for that ping, it should be there
  6. Download my script below (call it lastline_notify) and run it like this:
    ./lastline_notify ~/.irssi/fnotify & disown

[code lang=”python”]
import os
import sys
import pyinotify
import pynotify

if (len(sys.argv) != 2):
print "usage: lastline_notify "
filename = sys.argv[1]

class PTmp(pyinotify.ProcessEvent):
def process_IN_MODIFY(self, event):
print "Create: %s " % os.path.join(event.path,

#get the last line in file
with open(filename) as myfile:
msg_text = (list(myfile)[-1])

msg = pynotify.Notification("Irssi Notification:", msg_text)

wm = pyinotify.WatchManager()
mask = pyinotify.IN_MODIFY
notifier = pyinotify.Notifier(wm, PTmp())
wdd = wm.add_watch(filename, mask, rec=True)

while True:
if notifier.check_events():
except KeyboardInterrupt:

Viola! You now get a message in the upper right hand corner like if someone were to ping you on empathy. There might be a better way to do this, but it works for me! Both channel pings and queries should get a notification. This script runs as a daemon, so you shouldnt have to worry about it gobbling up CPU.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.