Author: @[email protected]
The typical Sway config file has a key binding to pop a nagging message to exit the session, like this one:
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
But it’s annoying because if you hit mod+shift+e accidentally, you have to go and click on the X to dismiss the nag. Weirdly, it happens to me a lot more than it should.
Here’s a slightly jazzed up keybinding you might like:
bindsym $mod+Shift+e exec pkill swaynag || (swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' & sleep 5 && pkill swaynag)
This adds two things:
- If you hit mod+shift+e accidentally, hit it again to dismiss the nag.
- Wait 5 seconds and the nag will disappear on its own anyway.