diff --git a/.config/hypr/scripts/logout.sh b/.config/hypr/scripts/logout.sh index 795b66e..2d87c0b 100755 --- a/.config/hypr/scripts/logout.sh +++ b/.config/hypr/scripts/logout.sh @@ -8,19 +8,35 @@ if [[ ! $(which swayidle 2> /dev/null) ]]; then exit 1 fi -choice=`echo -e "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical` +choice=$(echo -e "suspend\nshutdown\npoweroff\nreboot\nlock" | wofi -d --prompt "󰚥 Choose power option" -Oalphabetical) + + if test "$choice" = lock ; then + # sleep less when power on + if acpi -a | grep -q on; then + sleep_time=3600 + else + sleep_time=10 + fi + sleep 0.3 + bright=`light` + swayidle -w \ timeout 5 "light -S 1" resume "light -S $bright" \ - timeout 10 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' \ + timeout $sleep_time 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' \ & idlepid=$! + # swaylock -e -c 282828 --inside-color 00000003 - swaylock -S --effect-blur "5x5" --effect-vignette 0.5:0.5 --inside-color 00000003 \ - -e --ring-color 00000005 --line-color 00000035 + swaylock -S --effect-blur "12x12" --effect-greyscale --effect-vignette 0.5:0.5 --inside-color 00000000 \ + -e --ring-color 00000000 --line-uses-inside --indicator --clock --text-color 689d6a + kill $idlepid + + pkill waybar hyprctl dispatch dpms on + hyprctl dispatch exec waybar light -S $bright elif test -n "$choice"; then loginctl $choice