this post was submitted on 20 Jun 2025
10 points (100.0% liked)

swaywm

448 readers
4 users here now

dedicated to the Sway window manager, a drop-in replacement for the i3 window manager, but for Wayland instead of X11.

founded 5 years ago
MODERATORS
 

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.
top 1 comments
sorted by: hot top controversial new old
[–] markstos@lemmy.world 1 points 2 weeks ago

I quit Sway so rarely that I don’t have a keybinding for it. I have one for suspending/locking instead.

To exit, I use the terminal: swaymsg exit.

I never type that accidentally, so no warning is needed.