1
1
mirror of https://github.com/rywng/dotfiles.git synced 2024-11-24 20:01:49 +08:00
dotfiles/.config/sway/scripts/logout.sh

18 lines
459 B
Bash
Raw Normal View History

2021-08-16 22:21:31 +08:00
#!/bin/sh
choice=`echo "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d -Oalphabetical`
2021-08-16 22:21:31 +08:00
if test "$choice" = lock ; then
bright=`light`
swayidle -w \
timeout 5 "light -S 1" resume "light -S $bright" \
timeout 10 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
&
idlepid=$!
swaylock -e -c 161821 --inside-color 00000003
2021-08-16 22:21:31 +08:00
kill $idlepid
swaymsg "output * dpms on"
light -S $bright
return 0
fi
loginctl $choice