Subscription for some dbus properties doesn't work
Subscribers to the dbus properties displayedLength, historyLength and waitingLength are not informed about changes. In contrast this works with the property paused.
Start:
$ dbus-monitor path=/org/freedesktop/Notifications
signal time=1613901346.651660 sender=org.freedesktop.DBus -> destination=:1.134 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.134"
signal time=1613901346.651714 sender=org.freedesktop.DBus -> destination=:1.134 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.134"
After sending a notification with $ notify-send test:
method call time=1613901357.736964 sender=:1.135 -> destination=:1.116 serial=6 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=GetServerInformation
method call time=1613901357.738638 sender=:1.135 -> destination=:1.116 serial=7 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
string "notify-send"
uint32 0
string ""
string "test"
string ""
array [
]
array [
dict entry(
string "urgency"
variant byte 1
)
]
int32 -1
signal time=1613901359.306892 sender=:1.116 -> destination=:1.135 serial=26 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
uint32 6
uint32 2
After pause dunst with dunstctl set-paused true:
method call time=1613901403.092561 sender=:1.136 -> destination=org.freedesktop.Notifications serial=2 path=/org/freedesktop/Notifications; interface=org.freedesktop.DBus.Properties; member=Set
string "org.dunstproject.cmd0"
string "paused"
variant boolean true
signal time=1613901403.093260 sender=:1.116 -> destination=(null destination) serial=27 path=/org/freedesktop/Notifications; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.dunstproject.cmd0"
array [
dict entry(
string "paused"
variant boolean true
)
]
array [
]
Installation info
- Version:
Dunst - A customizable and lightweight notification-daemon v1.5.0-93-g3994895 - Install type:
git, manual build, executed locally within the build folder - Distro and version:
archlinux
the *Length properties are not marked to emit a changed status signal, so the behaviour is correct here. I'm curious, what's the usecase to want to monitor these fields constantly?
I'm writing a plugin for the py3status, a status bar for the i3 window tiling manager. If dunst is paused, because you want to be concentrate yourself on work, the plugin shall show the waiting notifications as a number (waitingLength).
After adding the emit in dbus.c:
" <property name=\"displayedLength\" type=\"u\" access=\"read\">"
" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
" </property>"
Nothing changed. I still don't get a dbus signal.
I don't know dbus too well, but you can take a look at how it's done for the paused property. When the property is changed this function is called.
g_dbus_connection_emit_signal(connection,
NULL,
object_path,
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
g_variant_new("(sa{sv}as)",
interface_name,
builder,
invalidated_builder),
NULL);
That's something I can work with. Thank you!
After some investigation today I figured out that the dbus properties like paused or waiting notifications are never updated. I couldn't find any trigger called in dunst.c and executed in dbus.c, which will notify all subscribers.
For pause the the subscriptions only works if dunst was paused through the dbus interface and not through SIGUSR1 or SIGUSR2.
Shouldn't be too hard to fix. Do you want to take a stab at it?