But I run irssi within screen on another machine in another network – I just ssh into that machine normally and resume the irssi-session with "screen -R". Thus I could not use lmacken's script :-(
I looked a bit more into that some time ago and came up with another solution: fnotify. Download it and put it as fnotify.pl in .irssi/scripts/ and load it in irssi with
/load perl
/script load fnotify
Is somebody chats to you directly (query) or mentions your nick somewhere in one of the channels it will put something like
#fedora-devel foo> ping thl
into ~/.irssi/fnotify . I can read that file from the client via ssh now and fire up notify-send locally. I use this startup script do realize that:
# 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 remote.system.somewhere "tail -n 10 .irssi/fnotify ; : > .irssi/fnotify ; tail -f .irssi/fnotify " | sed -u 's/[<@&]//g' | while read heading message do 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?)
This results is nice pop-ups in the bottom right corner of my desktop:

Site note: Yes, there are probably 1000 other ways to realize something like that. The above stuff is far from perfect, but it suits my needs.
6 Kommentare:
In the first set of commands, you dropped the 'f' from 'fnotify'. It should read:
/load perl
/script load fnotify
Otherwise, I don't have it working yet. That is, fnotify.pl is putting stuff in ~/.irssi/fnotify just fine, but I haven't been able to get anything meaningful via the local script yet. Running it generates a, "No summary specified." output.
> In the first set of commands, you
> dropped the 'f' from 'fnotify'.
Fixed
> Running it generates a, "No summary
> specified." output.
Seems notify-send isn't called properly. Put a "echo" in fromt of it to debug.
Hi Thorsten,
I did a little update of Luke's script as well. Mine doesn't require any tailing of files or other hacks; it calls notify-send and only assumes you have X forwarding on. See http://code.google.com/p/irssi-libnotify/ for the download.
Thanks for your script. Just a little side-note to your sed-hack: The Desktop Notification Specs allow some markup to be included in the message, so a cleaner solution would be: sed -u "s/</\</g;s/>/\>/g;"
I actually expanded it a little so I can now click URLs and the nicks are printed in bold.
It is missing a ";" just after before the "do" of "while..."
Works like a charm, thanks :)
good post
Kommentar veröffentlichen