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.

39 thoughts on “Better notification support

  1. 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?

    Like

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

    Like

  3. @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.

    Like

  4. 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.

    Like

  5. @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

    Like

  6. @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.

    Like

  7. @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.

    Like

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

    Like

  9. @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!

    Like

  10. @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.

    Like

  11. @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

    Like

  12. @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.

    Like

  13. 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.

    Like

  14. 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

    Like

  15. 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.

    Like

  16. 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.

    Like

  17. @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?

    Like

  18. @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:

    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
    

    Like

  19. 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?

    Like

Comments are closed.