I have my system configured such that when I receive new mail, a notification balloon appears on my screen. This is convenient at times, and distracting at other times. Without having to uninstall the gmail integration I'm using, is there a way of centrally toggling whether certain kinds of notifications will be displayed?
In other words, I'm looking for an application (or API) which allows me to either see a list of "registered" apps that use the notification service, and toggle them as enabled/disabled. Or, something which allows me to create one or more regular expressions which can be used to match the source-application-name or notification-bubble-content, and if a match occurs, to block the notification.
Best Answer
It's not really too bad, at least for a crude generic solution.
Here is a copy of the details from my answer to last year's (sept 2012) post in
How to disable notification from network-manager.
Replace
string "NetworkManager"
with the desired RE to determine blocking.To get an idea of what RE pattern match to look for run:
dbus-monitor "interface='org.freedesktop.Notifications'"
and look at the output while the notifications are popping-up.
ie. to remove
notify-send
messages also, use thisgrep
line instead:Caveat:
killall notify-osd
is non-discriminating and completely wipes the notification stack of any pending messages irregardless of whetherNetworkManager
ornotify-send
is the notifying agent.An "honest" solution needs to account for possible race conditions when between determining a notification purge is needed and then doing doing it, another notification comes in that should pop-up and not be purged with the rest.
Also, if notifications are pending when the offending one to be blocked comes in, they will all be purged. This situation can at least be solved by making a copy of the
dbus
pending notifications and then reissue the desired ones withnotify-send
after the purge.This is a bit of manually labour intensive work!
Ideally, the direct dbus use of
to specifically target just the desired notifications, is unfortunately not obvious ... however ...
Another answer
Can org.freedesktop.Notifications.CloseNotification(uint id) be triggered and invoked via DBus?
shows how to use
[1]
, at least withnotify-send
, but unfortunately not for arbitrary notifying aps. though some aps. have custom interfaces to control pop-up notifications.cross refs.: