1
1
mirror of https://github.com/rywng/dotfiles.git synced 2024-11-22 10:51:49 +08:00

format script code

This commit is contained in:
Ryan 2024-03-21 10:41:45 +08:00
parent 0618d4cd1d
commit 947364f20f

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# Modified from sway's locking script # Modified from sway's locking script
# TODO: remove bashism
if [[ ! $(which swayidle 2>/dev/null) ]]; then if [[ ! $(which swayidle 2>/dev/null) ]]; then
notify-send "ERROR" "Swayidle not found" notify-send "ERROR" "Swayidle not found"
@ -11,7 +11,6 @@ fi
choices=("suspend" "poweroff" "reboot" "lock") choices=("suspend" "poweroff" "reboot" "lock")
choice=$(printf "%s\n" "${choices[@]}" | fuzzel -d --prompt "🔌: ") choice=$(printf "%s\n" "${choices[@]}" | fuzzel -d --prompt "🔌: ")
if test "$choice" = lock; then if test "$choice" = lock; then
# sleep less when power on # sleep less when power on
if acpi -a | grep -q on; then if acpi -a | grep -q on; then
@ -20,8 +19,9 @@ if test "$choice" = lock ; then
sleep_time=10 sleep_time=10
fi fi
sleep 0.3 sleep 0.3
playerctl stop
bright=`light` bright=$(light)
swayidle -w \ swayidle -w \
timeout 5 "light -S 1" resume "light -S $bright" \ timeout 5 "light -S 1" resume "light -S $bright" \