Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom global actions #669

Open
rosshadden opened this issue Oct 25, 2019 · 7 comments
Open

Custom global actions #669

rosshadden opened this issue Oct 25, 2019 · 7 comments
Labels
Feature good first issue Good place to start for new contributors

Comments

@rosshadden
Copy link

Is there a way to add a custom global action that would be present in all notifications? I would like to add a copy action which would copy the text of the notification to my clipboard. For notifications created by me I would be able to specify a script and add this action, but most notifications on my system are not initiated by me.

@tsipinakis
Copy link
Member

Hi, this is not possible as actions are something the client (read: the program that sent the notification) does, the logic isn't being run on dunst, we only send back the action that was chosen.

However it might be a good idea to consider custom "actions" which in reality are scripts which are called in similar way to the script= directive in dunstrc. I'll leave this open for discussion as a feature request.

@infokiller
Copy link

I'm looking for the same functionality as well. Use case:
I'd like to add a notification action to copy OTP codes from SMS messages. Given the notification text, a simple regex to match consecutive digits will probably work fine for me. So I could add a custom action to process the notification content and copy OTP codes to the clipboard.

@sysfsss
Copy link

sysfsss commented May 12, 2021

Being able to middle click the popup to copy the latest notification to the clipboard would be excellent.

@AkashKrDutta
Copy link

+1 for this feature. It would be extremely helpful for me, to point out those notifications that I have missed from dunst (timed-out notifications). I could add a left-click/middle-click action to run a script to increase a shared counter variable. This counter can then be subtracted from dunstctl history count output to get count of those notifications missed from timeouts.

@MultiCoreNop
Copy link

Another nice way would be an environment variable DUNST_ADD_ACTIONS (maybe a BASH array) that allows adding (command line, action name) pairs. This could then be filled from within a "script=".

@yutkat
Copy link

yutkat commented Nov 9, 2023

I recently found the workaround to define custom actions and I will share it with you.

First, I call the shell script using script= in the condition that I want to call.
https://github.com/yutkat/dotfiles/blob/a6a483ded2912b9bda8ebaf790f59f5484a803c1/.config/dunst/dunstrc#L456-L459

Then, I could override the notification by adding $DUNST_ID to the --replace-id of notify-send.
Next, I can switch by action.
https://github.com/yutkat/dotfiles/blob/a6a483ded2912b9bda8ebaf790f59f5484a803c1/.config/dunst/scripts/libreoffice.sh#L9

@bynect
Copy link
Member

bynect commented Apr 29, 2024

maybe something like default_action or default_script would do

@bynect bynect added the good first issue Good place to start for new contributors label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature good first issue Good place to start for new contributors
Projects
None yet
Development

No branches or pull requests

8 participants