Better notification support


Yesterday I released a new version of my message notification extension for gnome-shell (3.2 and 3.4), to install it or to update it just visit its page on extensions.gnome.org.

The main feature in the new version is that it just handles notifications coming from well-known applications: Empathy, XChat, XChat-GNOME, Pidgin and notify-send. Handling the Empathy notifications is easy because they are well integrated with the shell, but the other notifications required some hack because all the applications handle notifications in different ways. I did my best to make the notifications as useful as possible, similar to the Empathy ones, but there are some small limitations.
Some of the handled applications require plugins to show notification bubbles:

  • Pidgin: Click on the “Tools” menu and then “Plug-ins”. Make sure that the “Libnotify Popups” plugin is enabled. If the plugin is not in the list it means you need to install it. On Debian the package is called “pidgin-libnotify”, other distros should have a package with a similar name.
  • XChat-GNOME: Click on the “Edit” menu and then “Preferences”. In the “Scripts and Plugins” tab make sure that “On-screen display” is enabled.
  • XChat: Click on the “Settings” menu and then “Preferences”. In the “Alerts” tab make sure that “Show tray baloons” is enabled for both “Private Message” and “Highlighted Message”. If the notifications pile up in the bottom right corner of your screen and clicking on them does nothing, it means that XChat is using notify-send because it cannot find libnotify. I don’t know how to fix this issue on different distros, but I found a Red Hat bug explaining the problem.

Message notification
Notifications coming from Empathy and XChat-GNOME

Is there any other common application that you would like to be handled by my plugin? The only prerequisite is that they somehow use standard notification bubbles (and this means I cannot implement it for Skype).

If you are looking for the source code, it’s in this git repository.

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

Reader Comments

I’m missing notifications from Jabber rooms; i.e. when someone directly talks to me prefixing my name in the sentence. Is it that Empathy doesn’t expose that notification, or that the extension doesn’t handle them?

Aleksander: this should be fixed with Empathy 3.4.1

Guillaume: great, thanks :-)

…and something about email notification? For example Gmail?

@Luca:
Notifications from where? Evolution?

┏┓ ╻  ┏━┓┏━╸╻┏ ╻  ╻┏━┓╺┳╸   ┏━┓╻  ╺━┓
┣┻┓┃  ┣━┫┃  ┣┻┓┃  ┃┗━┓ ┃    ┣━┛┃  ┏━┛
┗━┛┗━╸╹ ╹┗━╸╹ ╹┗━╸╹┗━┛ ╹    ╹  ┗━╸┗━╸

@Marco: perhaps from Gnome Account Online!

@Luca:
Gnome online accounts doesn’t actually check for emails. My extension relies on an application getting IM messages/emails/whatever and display a notification bubble. The extension will keep track of notifications and display the list and count.

:-(

There is error in Empathy 3.4.1 notification.

Notification is not working for:
1) contacts that have already a chat WINDOW opened (chat window is not active)
2) contact that chat TAB is active (chat window is not active).
Red notification icon is only blink fast and gone.

@m79reed:
It works for me. Why distro are you using? Which version of gnome-shell?
Can you please collect logs? See http://cgit.collabora.com/git/user/bari/shell-message-notifier.git/tree/README#n18

@barisione:
Archlinux, Gnome-shell 3.4.1-1
log:
Window manager warning: Log level 16: Could not initialize NMClient /org/freedesktop/NetworkManager: Launch helper exited with unknown return code 1
JS LOG: MESSAGE-NOTIFIER: initialised
JS LOG: MESSAGE-NOTIFIER: enabling
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: the new total count is 0

(gnome-shell:13159): Clutter-CRITICAL **: clutter_actor_insert_child_at_index: assertion `child->priv->parent == NULL’ failed
JS LOG: GNOME Shell started at Fri Apr 27 2012 16:27:58 GMT+0200 (CEST)
Window manager warning: Log level 16: fetch_connections_done: error fetching connections: (25) Launch helper exited with unknown return code 1.
Window manager warning: Log level 16: _nm_remote_settings_ensure_inited: (NMRemoteSettings) error initializing: Launch helper exited with unknown return code 1

JS LOG: NetworkManager is not running, hiding…
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item ‘TESTGTALK1′ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: TESTGTALK1
JS LOG: MESSAGE-NOTIFIER: ignoring as the count is 0
JS LOG: MESSAGE-NOTIFIER: the new total count is 0
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item ‘TESTGTALK1′ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: TESTGTALK1
JS LOG: MESSAGE-NOTIFIER: ignoring as the count is 0
JS LOG: MESSAGE-NOTIFIER: the new total count is 0

(gnome-shell:13159): Json-CRITICAL **: json_object_get_string_member: assertion `node != NULL’ failed
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item ‘TESTGTALK1′ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: TESTGTALK1
JS LOG: MESSAGE-NOTIFIER: processing with handler for key ‘telepathy’, the source count is 1
JS LOG: MESSAGE-NOTIFIER: added item ‘TESTGTALK1 (1)’
JS LOG: MESSAGE-NOTIFIER: the new total count is 1
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item ‘TESTGTALK1′ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: TESTGTALK1
JS LOG: MESSAGE-NOTIFIER: ignoring as the count is 0
JS LOG: MESSAGE-NOTIFIER: the new total count is 0

@m79reed:
It’s not the extension. For some reason the message is “marked as read”, so the count is updated and set to 0.
I think that the same would happen also if you were not using the extension.

Google Talk (the one in my web browser?)

@Leif:
It doesn’t use standard notification bubbles.

Your were looking for suggestions of other applications were support could be added: How about gajim?

@AF:
Gajim seems really broken, most of the time I don’t get notifications?

@barisione
What version of gnome-shell and Empathy have you installed?
I created a new user and the there is the same problem. Something marks notification as read for contacts that chat window/tab is opened (no active) so icon of your extension blinks only.

Thanks so much, Marco! Loving this extension. Does the job for me.

Any chance that this could become the one solution that fits all? What about irssi? Couldn’t you add support for Irssi too?

can you make this plugin work for irssi ?

E-Mail support (Tunderbird, Evolution, ..) would be nice or isn’t it intended for email?

@twohot, @alex:
Which script do you use with irssi to get notifications? I think there are several ones and it depends on whether you are using a remote or local irssi.
Could you please put http://cgit.collabora.com/git/user/bari/shell-message-notifier.git/plain/extension.js in ~/.local/share/gnome-shell/extensions/message-notifier@shell-extensions.barisione.org/ (to replace the existing one), press ALT-F2 and type R? After this you can collect logs as explained in the DEBUG section in http://cgit.collabora.com/git/user/bari/shell-message-notifier.git/tree/README#n18
Thanks!

@marcel:
I thought about that, but most people always have a bunch of unread emails and having unread emails is usually not as urgent as IMs.
There is also a technical problem as Evolution’s notification don’t contain enough easily-extractable information to make the integration with my extension very useful.

@Barisione
I use a script I got from a guy in #irssi at freenode. Its called “hilightwin.pl”. Most irssi scripts are written in perl anyway. The authors are Timor and Babar.

It works but there are issues. It uses notify-send mainly. You don’t get a cool red counter on the dash. Instead, you get a ‘school of icons’ at the bottom-right corner (the icons grow with each mention of your nick or query message).

I haven’t installed your extension yet. Where can I get it? What is it called at the gnome-shell website? URL? Thanks a lot

@twohot:
Then if you install the extension (just follow the first link in the post), irssi should just work as the extension already supports notify-send and it handles it better than gnome-shell does.

@barisione
OK, seems logic.
Thanks anyways for this great extension ;)

Love this extension! Any chance of adding gnome-phone-manager ? Empathy’s sms support isnt quite there for me at least. With this extension, however, that wouldnt matter much.

@Will Alexander:
When does gnome-phone-manager show popups exactly?
Could you please provide me the logs as explained in comment 23?

When the phone receives an incoming SMS message, gnome-phone-manager will pop-up alert window not a notification in the gnome-shell sense. Application runs in systray.

Here are the logs

JS LOG: MESSAGE-NOTIFIER: initialised
JS LOG: MESSAGE-NOTIFIER: enabling
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: the new total count is 0
JS LOG: GNOME Shell started at Fri May 11 2012 13:05:03 GMT-0400 (EDT)
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item ‘Phone Manager’ with no notifications
JS LOG: MESSAGE-NOTIFIER: ignoring as the count is NaN
JS LOG: MESSAGE-NOTIFIER: processing item ‘Removable Devices’ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: Removable Devices
JS LOG: MESSAGE-NOTIFIER: the new total count is 0
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item ‘Phone Manager’ with no notifications
JS LOG: MESSAGE-NOTIFIER: ignoring as the count is NaN
JS LOG: MESSAGE-NOTIFIER: processing item ‘Removable Devices’ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: Removable Devices
JS LOG: MESSAGE-NOTIFIER: processing item ‘Phone Manager’ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: Phone Manager
JS LOG: MESSAGE-NOTIFIER: the new total count is 0
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item ‘Phone Manager’ with no notifications
JS LOG: MESSAGE-NOTIFIER: ignoring as the count is NaN
JS LOG: MESSAGE-NOTIFIER: processing item ‘Removable Devices’ with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: Removable Devices
JS LOG: MESSAGE-NOTIFIER: the new total count is 0

Installed al-right but i get no notifications from irssi :(

@twohot:
Can you please update the plugin from the extensions website and give me some debugging logs? (The new version just contains extra code for helping with debugging.)
To get the logs see the instructions at http://cgit.collabora.com/git/user/bari/shell-message-notifier.git/tree/README#n18

This extension is great! I just have one problem with it. When I plug a removable device i.e. external hd or usb-stick i get a notification and it stays there forever until i ether remove it or close the “removable device indicator” on the right bottom corner. I think the notification should go away by clicking on notification, but it does not happen.
It would be nice when this kind of notification wouldn’t stay there always.

@Cristóbal:
Are you using an old version of the extension? If you go to the extensions page you should be able to update it.

Hi, I’ve installed again your extansion on 3.4 and it is not working now at least for Skype. It definetely worked in 3.2. Quick investigation reveals the issue after line 218. Here is a piece of code:

213 if (source.isChat)
214     key = 'telepathy';
215 else if (source.title == 'notify-send')
216     key = 'notify-send'
217 else if (source.app) 
218      key = source.app.get_id();

source.app is undefined here that’s why all futhure processing is skipped. I’ve added following lines:

219 else 
220     key = 'notify-send'

In this case all sources with undefined app will produce a norification.

Hope it helps other people to get notification working.

@alex:
The notify-send case is considered at line 215. Just assuming that everything else is notify-send is wrong because we would then start showing the icon for all the notifications that are not handled in previous cases.
Skype is not supported at all because it doesn’t use notification-daemon’s popups, at least in the version I have here.
Can you please provide logs as explained in comment 32 so I can take a look?

@barisione
Oh, i didn’t know that skype is not supported. I need to have all notifications catched so my ugly fix is working for me (i use classic-tray+remove bottom tray extensions). The logs:
[code]
JS LOG: MESSAGE-NOTIFIER: initialised
JS LOG: MESSAGE-NOTIFIER: enabling
JS LOG: MESSAGE-NOTIFIER: updating count
JS LOG: MESSAGE-NOTIFIER: processing item 'Skype' with 1 notifications:
JS LOG: MESSAGE-NOTIFIER: Skype
JS LOG: MESSAGE-NOTIFIER: the new total count is 0
[/code]

Great extensions!!

I just miss smuxi (IRC Client) integration.

Great extension!thanks xD

And I noticed it also shows jupiter notifications!

Is there, however, a way for the icon to display unread&new email count from mailnag?