2

Is there any way to prevent NotifyOSD (or XFCE-Notify) from displaying notifications from one particular application?

10
  • I think it depends on the application rather than notification-daemon application like xchat or empathy give you the option of disabling notification. Aug 9, 2011 at 4:39
  • Obviously I'm talking about an app that does not have this option...
    – Borsook
    Aug 9, 2011 at 9:21
  • which application are you talking about Aug 9, 2011 at 9:29
  • I mean Jupiter, it has some problems with notifications - under XFCE-notify they do not close, under NotifyOSD they get reopened several times before they close. Still it would be nice to prevent any app from spamming those.
    – Borsook
    Aug 9, 2011 at 12:00
  • seems like the notification is just the script located at /usr/lib/jupiter/scripts/notify just edit the script to do nothing Aug 9, 2011 at 12:16

1 Answer 1

4

Yes but with caveats ... killall notify-osd is aggressive ... to do this gracefully requires that pending notifications be saved before the offending one triggers killall notify-osd and then reinstate them preserving chronological integrity.

ref:
Close button on notify-osd?
it would be nice if: Can org.freedesktop.Notifications.CloseNotification(uint id) be triggered and invoked via DBus?

Monitor D-Bus to find notifications for removal that originate from the chosen application. Run this script in a terminal or as a background task, changing ap_name_to_silence to the name of the ap chosen for throttling:

dbus-monitor "interface='org.freedesktop.Notifications'"                \
| grep --line-buffered  'string "ap_name_to_silence"'                   \
| sed -u -e  's/.*/killall notify-osd/g'                                \
| bash

Basic Notify structure in dbus-monitor "interface='org.freedesktop.Notifications'" is

    method call sender=:1.278 -> dest=:1.151 serial=7 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
       string "notify-send"                          this is the app_name
       uint32 0                                      this is the replaces_id
       string ""                                     this is the app_icon
       string "test"                                 this is the summary
       string ""                                     this is the body
       array [                                       this is the actions pairs list
       ]
       array [                                       this is the hints dictionary
          dict entry(
             string "urgency"
             variant             byte 1
          )
       ]
       int32 -1                                      this is the expire_timeout

test silencer with these messages noting "silenced notification" is absent:

notify-send "sum airy" "ephemeral corporeal content"; sleep 5; 

gdbus call --session                                             \
    -d  org.freedesktop.Notifications                            \
    -o /org/freedesktop/Notifications                            \
    -m  org.freedesktop.Notifications.Notify                     \
                        ap_name_to_silence                       \
                        42                                       \
                        gtk-dialog-info                          \
                        "The target"                             \
                        "silenced notification"                  \
                        []                                       \
                        {}                                       \
                        5000

notify-send "augend airy" "ephemeral corporeal content - ie. white moo juice\!" 

gdbus call --session                                             \
    -d  org.freedesktop.Notifications                            \
    -o /org/freedesktop/Notifications                            \
    -m  org.freedesktop.Notifications.Notify                     \
                        my_app_name                              \
                        42                                       \
                        gtk-dialog-info                          \
                        "Summary"                                \
                        "but now it's autumny and not wintery"   \
                        []                                       \
                        {}                                       \
                        5000

Bookmark:
Is it possible to block NotifyOSD for one application?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.