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.
10 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
Ive bee working a bit with this, using the tail method as my server is headless (no X)...
Im using xdotool to check if my irssi window is active, the notify happens if not. Also playing a sound.
while read heading message;
do
if [ ! `xdotool search --name zzzAmazon` = `xdotool getactivewindow` ]
then
mplayer /usr/share/sounds/gnome/default/alerts/glass.ogg &
zenity --info --title="${heading}" --text="${message}"
fi
done
Hi this post is very old, but perhaps it would help someone:
there are two problems with bash script mentioned above. 1. when the script is interrupted, there are processes (tail -f) staying alive on the remote host. And 2. flushing the fnotify file on exit. This can be done with signal traping. Here's the updated script:
ssh -t user@remotehost "trap 'echo Exit requested.; :> ~/.irssi/fnotify; exit 0' SIGINT SIGTERM SIGKILL; tail -f .irssi/fnotify;" | sed -u 's/[<@&]//g' | while read heading message; do notify-send -i gtk-dialog-info -t 9000 -- "${heading}" "${message}"; done
Hello, FYI, I wrote in 2010 (and updated lately to version 1.0) a notification over ssh hack you can find over here: Notossh or on my github.
HTH,
--
guyzmo
Hi there, I wrote something similar, and it flushes old messages on disconnect.
Have a look:
https://ttboj.wordpress.com/2013/10/18/desktop-notifications-for-irssi-in-screen-through-ssh-in-gnome-terminal/
HTH,
James
Kommentar veröffentlichen