After install Xmonad with Unity2D I saw that notifications weren’t working as before with Ubuntu 11.04 with Xmoand/Gnome 2.30, I thought could be something related to Unity.
Anyway, notifications were working awfully bad, most of the times the daemon got stucked and I’ve to say goodbye to them. Today I’ve discovered the Polly Twitter client, a pretty cool twitter client with support to columns, but I realised that I wasn’t getting notifications, so I put my hands to work on discover why. The reason was simple, my system was running notification-daemon instead of notify-osd (the new notification system from Ubuntu), after a few minutes of googling, I couldn’t find any intersting result, just a few bugs on launchpad and some xession files requiring as DefaultProvider-notifications, notify-osd. It wasn’t after a while that I read this bug report from the begining and finally get noty-osd working as default in my system.
The problem was with this file /usr/share/dbus-1/services/org.freedesktop.Notifications.service, take a look at its content:
$ cat /usr/share/dbus-1/services/org.freedesktop.Notifications.service [D-BUS Service] Name=org.freedesktop.Notifications Exec=/bin/sh -c 'if [ ! -x /usr/lib/notification-daemon/notification-daemon ] || [ "$GDMSESSION" = guest-restricted ] || [ "$GDMSESSION" = gnome-classic-guest-restricted ] [ "$GDMSESSION" = default -a "$(basename `readlink /etc/alternatives/x-session-manager`)" = gnome-session ] || [ "$GDMSESSION" = ubuntu ] || [ "$GDMSESSION" = ubuntu-2d ]; then exec /usr/lib/notify-osd/notify-osd; else exec /usr/lib/notification-daemon/notification-daemon; fi'
Seems that execute notify-osd only if $GDMSESSION is some of the values above that check for equality, so, my next step was to see what have my $GDMSESSION,
% echo $GDMSESSION xmonad-unity-session
Yay! xmonad-unity-session wasn’t checked above! That name is obtained from the xessions dir,
% ls -1 /usr/share/xsessions gnome-classic.desktop gnome.desktop gnome-fallback.desktop gnome-shell.desktop ubuntu-2d.desktop ubuntu.desktop xmonad.desktop xmonad-unity-session.desktop xsession.desktop xterm.desktop
So, I’ve added my $GDMSESSION value to /usr/share/dbus-1/services/org.freedesktop.Notifications.service,
% cat /usr/share/dbus-1/services/org.freedesktop.Notifications.service [D-BUS Service] Name=org.freedesktop.Notifications Exec=/bin/sh -c 'if [ ! -x /usr/lib/notification-daemon/notification-daemon ] || [ "$GDMSESSION" = guest-restricted ] || [ "$GDMSESSION" = gnome-classic-guest-restricted ] [ "$GDMSESSION" = default -a "$(basename `readlink /etc/alternatives/x-session-manager`)" = gnome-session ] || [ "$GDMSESSION" = ubuntu ] || [ "$GDMSESSION" = xmonad-unity-session ] || [ "$GDMSESSION" = ubuntu-2d ]; then exec /usr/lib/notify-osd/notify-osd; else exec /usr/lib/notification-daemon/notification-daemon; fi'
then, log out from the session and log in again, and the problem was fixed, notifications are working amazingly well!
