Is it possible to block NotifyOSD for one application?

Solution 1:

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?