mirror of
https://github.com/rywng/dotfiles.git
synced 2024-11-24 20:01:49 +08:00
21 lines
529 B
Bash
21 lines
529 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
choice=`echo "shutdown\npoweroff\nreboot\nlock" | wofi -d -Oalphabetical`
|
||
|
if test "$choice" = lock ; then
|
||
|
tmp=/tmp/lockscreen.bmp
|
||
|
grim - | magick - -blur 0x6 $tmp
|
||
|
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 -i $tmp -c 000000 --inside-color 00000003
|
||
|
kill $idlepid
|
||
|
rm $tmp
|
||
|
swaymsg "output * dpms on"
|
||
|
light -S $bright
|
||
|
return 0
|
||
|
fi
|
||
|
loginctl $choice
|