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: 234

Filed under:
|

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

Related posts about notification

Related posts about dbus

  • Not able to compile dbus-ping-pong

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I have downloaded files from http://cgit.collabora.com/git/user/alban/dbus-ping-pong.git/tree/ I am trying to compile it using the command gcc pkg-config --libs --cflags dbus-1 dbus-glib-1-2 glib-2.0 -o dbus-ping-pong dbus-ping-pong.c However, I get errors: /tmp/ccmJkxXb.o: In function g_once_init_enter: dbus-ping-pong… >>> More

  • How to find other end of unix socket connection?

    as seen on Server Fault - Search for 'Server Fault'
    I have a process (dbus-daemon) which has many open connection over UNIX sockets. One of these connections is fd #36: =$ ps uw -p 23284 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND depesz 23284 0.0 0.0 24680 1772 ? Ss 15:25 0:00 /bin/dbus-daemon --fork… >>> More

  • symlink for dbus headers

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    Source code for something that won't compile has the line #include but in real life that header file is in /usr/include/dbus-1.0/ Similarsituation exists for the dbus-c++ package. Why doesn't Ubuntu provide a symlink /usr/include/dbus pointing to the dbus-1.0 directory? Is this an bug in the… >>> More

  • Resetting Update Manager

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    How can I fix Update Manager in 12.04, which hangs when I try to install any update, while sudo apt-get upgrade works fine? I suspect it has something to do with my python installation. This is the error message: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/defer/__init__… >>> More

  • How to get Webkit Browser DBus Bridge working?

    as seen on Stack Overflow - Search for 'Stack Overflow'
    I've been struggling to get the Browser Dbus Binding working for Webkit/GTK (http://gitorious.org/webkitgtk/stable) port. I have been able to successfully compile the Webkit/GTK port as well as the DBus binding library on my Ubuntu Lucid Beta. I also installed the DBus binding library at the standard… >>> More