added exit script

This commit is contained in:
array-in-a-matrix 2022-01-12 16:05:14 -05:00
parent 0f6ad995ed
commit 64d6dcdd46
2 changed files with 36 additions and 6 deletions

View file

@ -216,12 +216,12 @@ bindsym $mod+r mode "resize"
set $mode_system 1 lock, 2 logout, 3 suspend, 4 hibernate, 5 reboot, 6 shutdown
mode "$mode_system" {
bindsym 1 exec --no-startup-id $XDG_CONFIG_HOME/sway/sway-exit.sh lock, mode "default"
bindsym 2 exec --no-startup-id $XDG_CONFIG_HOME/sway/sway-exit.sh logout, mode "default"
bindsym 3 exec --no-startup-id $XDG_CONFIG_HOME/sway/sway-exit.sh suspend, mode "default"
bindsym 4 exec --no-startup-id $XDG_CONFIG_HOME/sway/sway-exit.sh hibernate, mode "default"
bindsym 5 exec --no-startup-id $XDG_CONFIG_HOME/sway/sway-exit.sh reboot, mode "default"
bindsym 6 exec --no-startup-id $XDG_CONFIG_HOME/sway/sway-exit.sh shutdown, mode "default"
bindsym 1 exec --no-startup-id $XDG_CONFIG_HOME/sway/exit.sh lock, mode "default"
bindsym 2 exec --no-startup-id $XDG_CONFIG_HOME/sway/exit.sh logout, mode "default"
bindsym 3 exec --no-startup-id $XDG_CONFIG_HOME/sway/exit.sh suspend, mode "default"
bindsym 4 exec --no-startup-id $XDG_CONFIG_HOME/sway/exit.sh hibernate, mode "default"
bindsym 5 exec --no-startup-id $XDG_CONFIG_HOME/sway/exit.sh reboot, mode "default"
bindsym 6 exec --no-startup-id $XDG_CONFIG_HOME/sway/exit.sh shutdown, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"

View file

@ -0,0 +1,30 @@
#!/bin/sh
lock() {
swaylock -f -c 000000
}
case "$1" in
lock)
lock
;;
logout)
swaymsg exit
;;
suspend)
lock && systemctl suspend
;;
hibernate)
lock && systemctl hibernate
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0