sway: add screensaver: lock and turn off display
This commit is contained in:
parent
6c50990ed6
commit
b6fcc08f61
3 changed files with 30 additions and 12 deletions
|
@ -2,19 +2,20 @@
|
||||||
|
|
||||||
TERM_CMD="foot -T float"
|
TERM_CMD="foot -T float"
|
||||||
LOCK_CMD="$HOME/.config/sway/bin/sway_lock"
|
LOCK_CMD="$HOME/.config/sway/bin/sway_lock"
|
||||||
SUS_CMD="$HOME/.config/sway/bin/sway_suspend"
|
PWR_CMD="$HOME/.config/sway/bin/sway_power"
|
||||||
|
|
||||||
### Idle configuration
|
### Idle configuration
|
||||||
|
# 9 min warning
|
||||||
# 10 min screen off
|
# 10 min screen off
|
||||||
# 15 min lock
|
# 15 min lock
|
||||||
# 30 min suspend on battery
|
# 60 min suspend on battery
|
||||||
# 120 min suspend
|
# 120 min suspend
|
||||||
pkill -x swayidle
|
pkill -x swayidle
|
||||||
swayidle -w \
|
swayidle -w \
|
||||||
timeout 1500 "$TERM_CMD bash -c 'dunstify -r 123 -u critical -t 300 display\ will\ turn\ off\ soon'" \
|
timeout 540 "echo $TERM_CMD bash -c 'dunstify -r 123 -u critical -t 300 display\ will\ turn\ off\ soon'" \
|
||||||
resume "$LOCK_CMD on" \
|
resume "echo $LOCK_CMD on" \
|
||||||
timeout 1800 "$LOCK_CMD off" \
|
timeout 600 "echo $LOCK_CMD off" \
|
||||||
timeout 2700 "$LOCK_CMD lockonly" \
|
timeout 900 "echo $LOCK_CMD lockonly" \
|
||||||
timeout 3600 "$SUS_CMD suspend-battery" \
|
timeout 3600 "echo $PWR_CMD suspend-battery" \
|
||||||
timeout 7200 "$SUS_CMD suspend" \
|
timeout 7200 "echo $PWR_CMD suspend" \
|
||||||
before-sleep "$LOCK_CMD lock"
|
before-sleep "echo $LOCK_CMD lock"
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export PATH=$PATH:$HOME/.config/sway/bin
|
export PATH=$PATH:$HOME/.config/sway/bin
|
||||||
IMG_BASE=$HOME/.local/share/icons/Tela-circle-dark
|
IMG_BASE=$HOME/.local/share/icons/Tela-circle-dark
|
||||||
IMG_LOCK=$IMG_BASE/scalable/apps/system-log-out.svg
|
IMG_LOCK=$IMG_BASE/scalable/apps/preferences-desktop-screensaver.svg
|
||||||
CMD_LOCK="sway_lock lock"
|
CMD_LOCK="sway_lock lock"
|
||||||
|
IMG_SCREENSAVER=$IMG_BASE/scalable/apps/preferences-desktop-screensaver.svg
|
||||||
|
CMD_SCREENSAVER="sway_lock screensaver"
|
||||||
IMG_SUSPEND=$IMG_BASE/scalable/apps/system-suspend.svg
|
IMG_SUSPEND=$IMG_BASE/scalable/apps/system-suspend.svg
|
||||||
CMD_SUSPEND="sway_power suspend"
|
CMD_SUSPEND="sway_power suspend"
|
||||||
IMG_SUSPEND_HIB=$IMG_BASE/scalable/apps/system-suspend.svg
|
IMG_SUSPEND_HIB=$IMG_BASE/scalable/apps/system-suspend.svg
|
||||||
|
@ -15,6 +17,7 @@ IMG_EXIT=$IMG_BASE/scalable/apps/system-restart.svg
|
||||||
CMD_EXIT="swaymsg exit"
|
CMD_EXIT="swaymsg exit"
|
||||||
|
|
||||||
echo -e "img:$IMG_LOCK:text:$CMD_LOCK
|
echo -e "img:$IMG_LOCK:text:$CMD_LOCK
|
||||||
|
img:$IMG_SCREENSAVER:text:$CMD_SCREENSAVER
|
||||||
img:$IMG_SUSPEND:text:$CMD_SUSPEND
|
img:$IMG_SUSPEND:text:$CMD_SUSPEND
|
||||||
img:$IMG_SUSPEND_HIB:text:$CMD_SUSPEND_HIB
|
img:$IMG_SUSPEND_HIB:text:$CMD_SUSPEND_HIB
|
||||||
img:$IMG_POWEROFF:text:$CMD_POWEROFF
|
img:$IMG_POWEROFF:text:$CMD_POWEROFF
|
||||||
|
|
|
@ -7,7 +7,8 @@ SCROT_APP_ARGS=" -t png -l 0"
|
||||||
SCROT_FILE_BASE=$HOME/.lockscreen
|
SCROT_FILE_BASE=$HOME/.lockscreen
|
||||||
SCROT_FILE_EXT=png
|
SCROT_FILE_EXT=png
|
||||||
LOCK_APP=swaylock
|
LOCK_APP=swaylock
|
||||||
LOCK_ARGS=" -f -F -e -s fill -c 000000 --indicator-radius 100 --indicator-thickness 20"
|
# LOCK_ARGS=" -f -F -e -s fill -c 000000 --indicator-radius 100 --indicator-thickness 20"
|
||||||
|
LOCK_ARGS=" -F -e -s fill -c 000000 --indicator-radius 100 --indicator-thickness 20"
|
||||||
INHIBIT_FILE=$HOME/.inhibit_lock
|
INHIBIT_FILE=$HOME/.inhibit_lock
|
||||||
|
|
||||||
CONVERT=convert
|
CONVERT=convert
|
||||||
|
@ -70,6 +71,9 @@ case "$1" in
|
||||||
i*)
|
i*)
|
||||||
_set_inhibit $INHIBIT_FILE $2
|
_set_inhibit $INHIBIT_FILE $2
|
||||||
;;
|
;;
|
||||||
|
clean)
|
||||||
|
_clean
|
||||||
|
;;
|
||||||
lock)
|
lock)
|
||||||
_on
|
_on
|
||||||
_screenshot
|
_screenshot
|
||||||
|
@ -88,13 +92,23 @@ case "$1" in
|
||||||
_on
|
_on
|
||||||
_clean
|
_clean
|
||||||
;;
|
;;
|
||||||
|
screensaver)
|
||||||
|
_screenshot
|
||||||
|
swayidle -w \
|
||||||
|
timeout 5 'swaymsg "output * dpms off"' \
|
||||||
|
resume 'swaymsg "output * dpms on"' &
|
||||||
|
PID=$!
|
||||||
|
_lock
|
||||||
|
_clean
|
||||||
|
kill $PID
|
||||||
|
;;
|
||||||
screenshot)
|
screenshot)
|
||||||
_on
|
_on
|
||||||
_screenshot
|
_screenshot
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "invalid argument \"$1\""
|
echo "invalid argument \"$1\""
|
||||||
echo "arguments: [inhibit [on|off]|lock|lockonly|off|on|screenshot]"
|
echo "arguments: [inhibit [on|off]|lock|lockonly|off|on|screensaver|screenshot]"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue