dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.42k stars 338 forks source link

How to programmatically send progress bar notifications? #1357

Closed lordofscripts closed 1 month ago

lordofscripts commented 1 month ago

I am using a Raspberry π 2 with dunst v1.5 (yes, it is behind on my distro).

I am writing a GO application that uses GoDBus/v5. So, I am not asking about how to use dunstify.

My question is what is the name of the Hint which is used to indicate a progress notification, and which type of value (string with percent?, uint32/64? ).

lordofscripts commented 1 month ago

I looked at the specs and cannot find anything. The dunst documentation shows how to do it with dunstify but that's not helpful if one needs to send it via a program.

bynect commented 1 month ago

you can find the dbus interface here https://github.com/dunst-project/dunst/blob/20033b86595c3967a20a476065443e515e39ac63/src/dbus.c#L35

for the specific thing you asked the code is here https://github.com/dunst-project/dunst/blob/20033b86595c3967a20a476065443e515e39ac63/src/dbus.c#L711

Both type G_VARIANT_TYPE_INT32 and G_VARIANT_TYPE_UINT32 is accepted

It should be passed as a parameter named "value" to the method

lordofscripts commented 1 month ago

Thanks a million! That did it. BTW, is the default action specified as a Hint with key "action_name" and its value being the specific action's key name? Just wondering.

bynect commented 1 month ago

Glad to help.

BTW, is the default action specified as a Hint with key "action_name" and its value being the specific action's key name?

I'm not too sure. From a glance it doesn't seem like it

lordofscripts commented 1 month ago

BTW in dbus.c line #2007 there is a typo error in the closed notification reason string, it reads "undfined" instead of "undefined"