Add mouse-free exit to sway
This commit is contained in:
parent
68b2c346f1
commit
00fc6fdc1b
|
@ -294,8 +294,8 @@ exec sudo ~/.configs_pointer/bin/switch_keyboard.sh pc
|
|||
bindsym $mod1+i exec ~/.config/sway/toggle_fcitx.sh
|
||||
# Mako notifications
|
||||
exec mako
|
||||
# Exit sway (logs you out of your Wayland session)
|
||||
bindsym $mod2+Escape exec swaynag -t warning -m 'Are you sure you want to exit sway?' -b 'Yes, exit sway' 'swaymsg exit'
|
||||
# Exit sway (hit 3 times repeatedly to force exit)
|
||||
bindsym $mod2+Escape exec ~/.config/sway/sway_exit.sh
|
||||
|
||||
# Screenshots ====
|
||||
bindsym $mod2+6 mode "screenshots"
|
||||
|
|
25
sway/sway_exit.sh
Executable file
25
sway/sway_exit.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
# Prompts for confirmation. 3 consecutive calls force exit without confirmation
|
||||
declare -r CNT_FILE=~/.config/sway/sway_exit_counter
|
||||
declare -ri MAX_COUNT=3
|
||||
|
||||
if [[ -e "$CNT_FILE" ]]; then
|
||||
declare -i count="$(cat "$CNT_FILE")"
|
||||
else
|
||||
declare -i count=0
|
||||
fi
|
||||
|
||||
(( count++ ))
|
||||
|
||||
if [[ $count -ge $MAX_COUNT ]]; then
|
||||
swaymsg exit
|
||||
else
|
||||
echo "$count" > "$CNT_FILE"
|
||||
|
||||
swaynag -t warning \
|
||||
-m 'Are you sure you want to exit sway?' \
|
||||
-Z 'Yes, exit sway' \
|
||||
"swaymsg exit; rm $CNT_FILE"
|
||||
fi
|
||||
|
||||
rm ~/.config/sway/sway_exit_counter &>/dev/null
|
Loading…
Reference in a new issue