diff options
author | Amin Bandali <amin@gnu.org> | 2018-09-17 11:37:44 -0400 |
---|---|---|
committer | Amin Bandali <amin@gnu.org> | 2018-09-17 11:37:44 -0400 |
commit | 11a97c6847ba346367987bae67c28ea3613c595a (patch) | |
tree | 672c7e40f7b007743ec4ae3673c5ad701aa09072 | |
parent | 058cb2c7d3c91c41a76b4c20b71d4551db5b2653 (diff) | |
download | configs-11a97c6847ba346367987bae67c28ea3613c595a.tar.gz configs-11a97c6847ba346367987bae67c28ea3613c595a.tar.xz configs-11a97c6847ba346367987bae67c28ea3613c595a.zip |
[rc/sway] bind XF86PowerOff to prompt for system exit action
- (l)ock
- (e)xit sway
- (s)uspend
- (h)ibernate
- (r)eboot
- (S)hutdown
need to inhibit systemd's handling of the power button using
systemd-inhibit (or alternatively and less elegantly by modifying
/etc/systemd/logind.conf, which i didn't want to do)
-rw-r--r-- | rc.org | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -3771,6 +3771,10 @@ insert_pass="Alt+n" #+begin_src conf exec xrdb .Xresources exec dunst +exec pgrep -x "systemd-inhibit" || \ + systemd-inhibit --what=handle-power-key --who=aminb \ + --why="Handle power button in sway" sleep infinity + ### Variables # super set $mod Mod4 @@ -3991,6 +3995,27 @@ mode "resize" { bindsym $mod+Shift+r mode "resize" # +# Power button +# +set $locker swaylock && sleep 1 + +set $mode_system System (l)ock, (e)xit sway, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown +mode "$mode_system" { + bindsym l exec $locker, mode "default" + bindsym e exec swaymsg exit, mode "default" + bindsym s exec $locker && systemctl suspend, mode "default" + bindsym h exec $locker && systemctl hibernate, mode "default" + bindsym r exec systemctl reboot, mode "default" + bindsym Shift+s exec systemctl poweroff -i, mode "default" + + # back to normal: Enter, Escape, or q + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym q mode "default" +} +bindsym XF86PowerOff mode "$mode_system" + +# # Status Bar: # # Read `man 5 sway-bar` for more information about this section. |