dotfiles/bin/swaylock-wrapper

18 lines
411 B
Bash
Executable File

#!/bin/bash
lock="swaylock"
lockt="exec ~/utils/bin/sway-locker -t"
revert() {
killall swayidle
swayidle -w timeout 3600 "$lock" \
timeout 3610 'swaymsg "output * power off"' \
resume 'swaymsg "output * power on"' \
before-sleep "$lockt"
}
trap revert HUP INT TERM
swayidle -w timeout 5 'swaymsg "output * power off"' \
resume 'swaymsg "output * power on"' &
swaylock -C ~/.config/swaylock/config
revert