You can ring my bell.I’ve been using xchat-gnome on Fedora for quite a while. It’s been my default chat client because the way it notifies about private or channel messages fits well with my workflow. However, recently I’ve wanted more often to encapsulate my chat in a screen session along with my other work. Of course, the obvious answer to this is Irssi, a popular text-based client. I still tend to also have a web browser open often in a GNOME session, though, so notifications are very useful to me. For a while I used Irssi with a simple plugin script that calls notify-send to create popup notifications. However, I hadn’t used it since the GNOME 2.30-2.32 days, and I found this script had developed drawbacks as it aged against the new GNOME 3 environment. For example, the notifications would fill up the notification tray over the course of the day. Clearing them required an action for each individual notification, which was tedious to say the least. Also, the --timeout argument to notify-send seemed to no longer work for me to make the notification leave the notice area after a specific length of time. What I really wanted was a solution that would act more like many of the other native GNOME applications. Appointment notifications or email in Evolution, for instance, “stack” in the notification area into a single icon, with a number that tells you how many notices have been received. Thankfully a few GNOME folks — Marina, Matthias, and Ray — kindly gave me some advice on solutions. First, there’s a hint called transient for notifications that lets them evaporate from the notification area after a specific time. (You can find the full notification spec here if you want to dig a little deeper; I found it really educational.) This was a step forward because it kept the notices from piling up in the notification area ad infinitum. For instance:
Unfortunately, just using transient meant I’d likely miss some notices if I was away when they came in. I wouldn’t know someone was looking for me unless I switched to my Irssi window to look — which is precisely the thing that notifications should prevent. Nevertheless, it’s a really useful hint, so file that away for later reference. Never fear though, because again the GNOME folks passed on some good advice. The stacking effect is handled automatically by GNOME Shell if the notifications are issued from the same PID. Aye, there’s the rub! The Irssi plugin I was using made this impossible, because it called the notify-send executable for each message, meaning a new process for each instance. What I really needed was a single process listening on the session D-Bus that could kick off a notification. So what I came up with can be found here. If you want to just test the listener, maybe because you don’t use Irssi, try this command with the listener running:
The listener is just a dead-simple (or maybe I should say brain-dead, given the quality of code) Python script. I put it in ~/bin with the executable bit set on, added it to my list of applications that launch with my GNOME session using gnome-session-properties, and added the new notify Perl plugin for Irssi to my ~/.irssi/scripts/ folder, with a symlink from ~/.irssi/scripts/autorun/ so it starts whenever I run Irssi. The stacking of notifications makes them very easy to clear with one user action — aaah, much better! Future thoughts:
| |
4 Comments |









FranciscoD said,
February 18, 2012 @ 4:38 am
Works great! Thanks!
Greg DeKoenigsberg said,
February 28, 2012 @ 10:59 pm
Of course, I ssh to a remote system and run irssi on screen, so this doesn’t work for me. I need to figure out a script that emails or texts me when I’m pinged, but I haven’t bothered to find it yet. :/
Pádraig Brady said,
February 29, 2012 @ 7:50 am
Cool thanks!
I linked this info from the 3rd item in “the Bad” section here: http://pixelbeat.org/docs/f16.html
Paul said,
February 29, 2012 @ 8:37 am
@Greg: I have a solution for that, although it too is a bit hacky. I’m usually in the same situation, SSH from my desktop workstation (bigger monitor and real keyboard) to my laptop which is actually connected over VPN to all the things I need during the day. I’ll post more about this later, although I’m not sure my solution is strictly trustworthy (in the security sense).