dunst-project / dunst

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

actions are invalidated in case of closeNotification message #1219

Closed dmitry-j-mikhin closed 11 months ago

dmitry-j-mikhin commented 11 months ago

Dunst documentation has the following statement:

Actions are invalidated once the notification is closed, so you cannot execute that action when you bring back a notification from history.

It looks like actions are also invalidated in case of a closeNotification message. I have ignore_dbusclose = true in dunstrc so notifications don't close in case of a closeNotification message, but I can't take action on them once the message is received. I think actions should not be invalidated in the case of ignore_dbusclose = true or there should be a separate option to control invalidation of actions.

P.S.

$ dunst -v
Dunst - A customizable and lightweight notification-daemon 1.9.2
bynect commented 11 months ago

This is actually the expected behavior because ignore_dbusclose is only a thing made by dunst. To remain compliant with the notification protocol dunst "lies" to the program by saying that it closed the notification (even if it didn't).

dmitry-j-mikhin commented 11 months ago

@bynect thanks for the explanation. Can I ask one more thing: how do actions actually work? Is there an action (such as a URL) in the notification that I can use later. Or the action is something that I need to double-check against the notification protocol from the sender before executing it. Sorry for the stupid questions.

bynect commented 11 months ago

@bynect thanks for the explanation. Can I ask one more thing: how do actions actually work? Is there an action (such as a URL) in the notification that I can use later. Or the action is something that I need to double-check against the notification protocol from the sender before executing it. Sorry for the stupid questions.

As far as I know, actions are "synchronous" in the sense that if a notification is dismissed by either the program or the user, they can no longer be used. At least for dunstify, waiting for actions if blocking. for other programs it isn't, but it still does expire when the notification goes away.

Maybe you can do what you want with some scripting being run on a notification?

dmitry-j-mikhin commented 11 months ago

Yes, I checked https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html and it looks like I can't use actions after the org.freedesktop.Notifications.NotificationClosed signal. I use Firefox notifications with a web messenger app inside. By default, when you click on a notification, the corresponding chat or thread opens in which the message appears, which is very convenient. But if I was busy coding or drinking tea and didn't manage to click on the notification in time, I can no longer use this action and have to search for threads and chats manually, which is frustrating) I tried some tweaks from https://stackoverflow.com/questions/60546650/make-chrome-firefox-notifications-to-stay-longer, but that doesn't help. Looks like Dunst scripting won't help either.

So it looks like it's not Dunst's problem anyway. The issue can be closed.