How to disable system tray notifications in 14.04?

Solution 1:

To completely turn off notifications, open a Terminal (Ctrl+Alt+T) and type the following command:

sudo mv /usr/share/dbus-1/services/org.freedesktop.Notifications.service /usr/share/dbus-1/services/org.freedesktop.Notifications.service.disabled

Finally restart your system to open a new session without notifications bubbles.

Solution 2:

Effectively disable notifications without messing with your system

A shamelessly ugly, but guaranteed perfectly working solution below. Although it is ugly, I can't see a real downside, and when no other options seem to exist or work, I believe we are excused.

The solution

From this nice answer, we learn that you can keep an eye on upcoming notifications. If we edit the command in that answer a bit, to simply kill the notification before it actually pops up, we effectively disable notifications. The set up:

  1. Create a small script with the following content:

    #!/bin/bash
    
    dbus-monitor "interface='org.freedesktop.Notifications'" | grep --line-buffered "string" | grep --line-buffered -e method -e ":" -e '""' -e urgency -e notify -v | grep --line-buffered '.*(?=string)|(?<=string).*' -oPi | grep --line-buffered -v '^\s*$' | xargs -I '{}' pkill notify-osd
    
  2. Save it as nonotifications.sh, and make it executable

  3. Test- run it by running in a terminal:

    /path/to/nonotifications.sh
    

    (keep it running)

  4. If all works fine, add it to your Startup Applications. Choose Dash > Startup Applications > Add. Add the command:

    /bin/bash -c "sleep 15 && /path/to/nonotifications.sh"
    

Additional options

The fun part is that the solution can be connected to a script, as mentioned here, to (for example) only allow certain notifications, or only disable specific ones.