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

"dunstctl close" doesn't work if notification was triggered by others #1427

Open
therealmaxmoon opened this issue Dec 31, 2024 · 5 comments
Open

Comments

@therealmaxmoon
Copy link

Issue description

I am using dunst for my notifications, but after installing a newer and fresh Linux on my system I figured out dunst changed the way how to handle key bindings and it can only be controlled by dunstctl now.

To close a notification I have a key binding in i3wm to close the notification:

bindsym Ctrl+Mod1+f exec dunstctl close

With this it is possible to close a notification, which were triggered like this:

notify-send "This is a test"

The problem is, I have scripts in the background, like mount scripts, which will notify me if something happens. I can't close those notifications with the command mentioned above. The script contains this line:

su maxmoon -c "export DISPLAY=:0.0 && notify-send \"USB\" \"unmounted $partition\""

For testing one can use this command to trigger notifications:

sudo su $USER -c "notify-send hallo"

Is there a way to close a notification on one screen independent on who send the notification? Clicking on it works, but it would be really pathetic if I have to use my mouse every time a script notifies me.

Installation info

  • Version: 1.5.0 (2020-07-23)
  • Install type: package
  • Window manager / Desktop environment: i3wm
  • Distro:MX Linux 23.3
@bynect
Copy link
Member

bynect commented Dec 31, 2024

I'm not sure what you mean by dunst changed they keybindings since they should work the same on x11.

Anyway you can do what you want by changing the user then executing dunstctl

@bynect
Copy link
Member

bynect commented Dec 31, 2024

su maxmoon -c "export DISPLAY=:0.0 && dunstctl close"

@bynect
Copy link
Member

bynect commented Dec 31, 2024

If the notifications are executed on a different user/process than the normal one we cannot directly do anything about it unfortunately

@therealmaxmoon
Copy link
Author

I'm not sure what you mean by dunst changed they keybindings since they should work the same on x11.

I always had Ctrl+Space as a key binding to close the last notification and Ctrl+Shift+Space to reopen the last one. Since I reinstalled my computer, because of newer Linux, those didn't work anymore (I imported my old dotfiles). dunst switched from key bindings in a config file to dunstctrl.

On MX Linux 21.3 this worked and on MX Linux 23.3 it didn't work anymore and I had to use new key bindings, like Ctrl+Alt+f to close a notification, which was weird and I don't know exactly, why the shorter one don't work?

su maxmoon -c "export DISPLAY=:0.0 && dunstctl close"

Thank you, I will try it soon.

@bynect
Copy link
Member

bynect commented Jan 1, 2025

Keyboard shortcuts are defined in the following format: "Modifier+key" where the modifier is one of ctrl,mod1,mod2,mod3,mod4 and key is any keyboard key.

Note that the keyboard shortcuts have been moved to the global section of the config for consistency with other settings.

from the docs. maybe you use the old syntax for shortcuts in the other section?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants