Notification – How to Disable Dunst and Revert to Notify-OSD

dbusnotification

I installed i3, which recommends dunst, but I'm not using i3 at the moment, and the dunst notifications don't really fit with Unity. I'd rather not uninstall dunst totally, since I might want to start using it at some point in the future; is there a way to switch back to notify-osd without uninstalling dunst?

Best Answer

The notification daemon is started by dbus-daemon when a notification is sent. You can see the currently-active notification daemon (assuming there is one) by searching for the org.freedesktop.Notifications bus name on the session bus in D-Feet; you can also examine journalctl output to see what dbus-daemon thinks it's doing, and why (including e.g. which application sent a notification).

dbus-daemon looks at the service files in /usr/share/dbus-1/services/ to find the service to run for each bus name. The file org.freedesktop.Notifications.service is the file for notify-osd (on default Ubuntu 18.04), and dunst installs a new service at org.knopwob.dunst.service. Both files have a Name of org.freedesktop.Notifications, meaning that they're both capable of handling notifications.

Unfortunately, dbus-daemon isn't very clever when it comes to working out which service to start when there are multiple possible services for a given bus name. As of 2018, it just picks the first one it finds; there's been a feature request in Red Hat Bugzilla about this for almost a decade. The only real solutions appear to be:

  • write your own service that picks whether to start notify-osd or dunst based on some factor (covered in this answer), or
  • move or delete all but one of the conflicting service files.

Moving the conflicting service files is much easier in this case: just run sudo mv /usr/share/dbus-1/services/org.knopwob.dunst.service{,.disabled}. If you want to start using dunst again, it's easy enough to rename the file back to what it was originally.