Can org.freedesktop.Notifications.CloseNotification(uint id) be triggered and invoked via DBus?
Posted
by
george rowell
on Ask Ubuntu
See other posts from Ask Ubuntu
or by george rowell
Published on 2012-09-19T04:28:27Z
Indexed on
2012/09/19
15:54 UTC
Read the original article
Hit count: 253
notification
|dbus
ref:
Close button on notify-osd?
Bookmark:
Can org.freedesktop.Notifications.CloseNotification(uint id) be triggered and invoked via DBus?
Currently, this script
dbus-monitor "interface='org.freedesktop.Notifications'" | \
grep --line-buffered "member=Notify" | \
sed -u -e 's/.*/killall notify-osd/g' | \
bash
will kill all pending notifications.
It would be better to finesse the specific target OSD notification to cancel, by using org.freedesktop.Notifications.CloseNotification(uint id)
. Is there an interface method that can put this on (in?) the DBus to fire when a particular notify event occurs?
The method will need to get the notify PID to use as the argument for CloseNotification(uint id)
. Alternatively,
qdbus org.freedesktop.Notifications \
/org/freedesktop/Notifications \
org.freedesktop.Notifications.CloseNotification(uint id)
could be used from the shell, if the (uint id)
argument could be determined. The actual command syntax would use an integer in place of (uint id)
.
Perhaps a better question to ask first might be "How is the DBus address for a notification found?".
In hindsight the previous question "How is the (uint id)
for a notification found?" is rhetorical! This previous answer:
http://askubuntu.com/a/186311/89468
provided details so either method below can be used:
gdbus call --session --dest org.freedesktop.DBus \
--object-path / \
--method org.freedesktop.DBus.GetConnectionUnixProcessID :1.16
returning:
(uint32 8957,)
or
qdbus --literal --session org.freedesktop.DBus / \
org.freedesktop.DBus.GetConnectionUnixProcessID :1.16
returning:
8957
© Ask Ubuntu or respective owner