1
1
mirror of https://github.com/rywng/dotfiles.git synced 2024-10-30 23:51:51 +08:00
dotfiles/.config/hypr/scripts/logout.sh

26 lines
645 B
Bash
Raw Normal View History

2023-12-03 13:36:10 +08:00
#!/bin/sh
#
# Modified from sway's locking script
if [[ ! -e /bin/swayidle ]]; then
notify-send "ERROR" "Swayidle not found"
exit 1
fi
choice=`echo -e "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical`
if test "$choice" = lock ; then
bright=`light`
swayidle -w \
timeout 5 "light -S 1" resume "light -S $bright" \
timeout 10 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' \
&
idlepid=$!
swaylock -e -c 282828 --inside-color 00000003
kill $idlepid
hyprctl dispatch dpms on
light -S $bright
else
loginctl $choice
fi