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

18 lines
525 B
Bash
Raw Normal View History

2022-06-25 21:26:38 +08:00
#!/bin/sh
2023-07-16 16:15:24 +08:00
choice=`echo -e "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical`
2022-06-25 21:26:38 +08:00
if test "$choice" = lock ; then
2023-10-10 21:24:00 +08:00
bright=`light`
swayidle -w \
timeout 5 "light -S 1" resume "light -S $bright" \
timeout 10 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
&
idlepid=$!
swaylock -e -c 282828 --inside-color 00000003
kill $idlepid
swaymsg "output * power on"
light -S $bright
else
loginctl $choice
2022-06-25 21:26:38 +08:00
fi