#!/bin/bash -x
# yes, we need a way to flush the file on disconnect; i don't know one
# yes, that's flush is not atomic (but good enough for me)

ssh some.domain.com "tail -n 5 ~/.irssi/fnotify ; : > ~/.irssi/fnotify ; tail -f ~/.irssi/fnotify " | sed -u 's/[<@&]//g' | while read heading message;  do  /usr/bin/notify-send -i gtk-dialog-info -t 300000 -- "${heading}" "${message}"; done 
# the sed -u 's/[<@&]//g' is needed as those characters might confuse  notify-send (FIXME: is that a bug or a feature?)
