XChat notifications on GNOME 3
Published 07 May 2011
Yesterday I decided to upgrade my Gentoo system to GNOME 3. It was not a painless process, although I must admit I expected worse.
One of the small annoyances that issued from the migration was that I could no longer rely on a blinking XChat tray icon to warn me of new IRC messages since, well, there’s no immediately visible tray. Messing with the alarm settings in XChat, I came across an option to display Notification Baloons with libnotify. Thinking it might be nice to have an occasional balloon popping up with the new message text, I enabled it.
It did work, but:
![]() |
| — So many messages! |
For every message sent, not only a balloon would pop up and vanish after a few seconds, but also an icon would persist in the notification panel. The notification panel would shortly be cluttered by lots of useless icons. (Ok, so this screenshot is actually me reproducing the problem manually, and not XChat causing it, but you get the idea).
Looking up the problem a bit, I found out that it had happened before, and could be solved by simply spawning the notification balloon with the appropriate parameters (namely, with a new transient hint set).
So, by grepping the XChat 2.8.8 source code for notify-send, I eventually reached the file where the magic happens, which looked somewhat like this.
After tinkering a bit, I found out that XChat 2.8.8 first attempts to load libnotify dynamically in order to use notification balloons, and if that fails, it falls back to calling the notify-send utility. So adding the transient hint would require changes in two sections of the code.
And here’s the diff of my modifications. Basically I used notify_notification_set_hint in the code section that attempts to use libnotify and added the command line parameter described in the bug above to notify-send.
After applying this and compiling, notifications no longer leave icons in the panel, which is exactly what I wanted.
I eventually found out that due to some bugs present in my version of XChat, the libnotify code (but not the notify-send code) always fails even before my changes have a chance to run. Well, at least I didn’t break it any further.
Come to think of it, I should probably have tried the latest SVN version first, since it fixes several issues with that specific file. But I had my fun anyway, and will gladly upgrade when the next XChat version comes out.
Toggle Comments
