Gnome Shell and transient notifications

I like that Gnome Shell is mostly written in JavaScript. It allows cool and easy hacking.

I am using weechat for my IRC chatting. Since I am running it on a server (via ssh) and I want to be notified about highlights and private messages, I am using simple rnotify.tcl plugin that sends notifications over (tunneled) tcp to local server that calls notify-send command. Easy setup that just works.

But there is an issue with Gnome Shell, because its notification daemon keeps all the messages in the queue until user explicitly clicks on them. This is cool for important messages, but Gnome Shell does the same with low priority messages.

Try this multiple times:

# notify-send test

and your notification queue is full. It can run out of the screen in short time. Yes, until today you could DoS me via IRC. Dmitri you were almost there today :-)

A bit of hacking around /usr/share/gnome-shell/js directory (files notificationDaemon.js and messageTray.js) and one finds out there is possibility to send "transient" flag in the hints array parameter (but must be boolean). Well, notify-send can't send arrays. The only way is to use dbus-send:

# dbus-send --print-reply --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.Notify string:"weechat" int32:1 string:"mail-unread" string:"bla bla blah" string:"" array:string:"" dict:string:boolean:"transient","true"

That's it. The notification gets discarded automatically upon hiding.

More info at Notification DBUS documentation and dbus-send man page.
13 July 2011 | weechat | gnome-shell