dotfiles/home/default/.local/bin/idle

25 lines
632 B
Bash
Executable File

#!/bin/zsh
if [[ -z "$1" ]] && [[ "$WINDOW_MANAGER" == "river" ]] ; then
swayidle -w \
timeout 310 'swaylock' \
timeout 300 'wlopm --off "*"' resume 'wlopm --on "*"' \
before-sleep "swaylock"
fi
if [[ -z "$1" ]] && [[ "$WINDOW_MANAGER" == "sway" ]] ; then
swayidle -w \
timeout 310 'swaylock' \
timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep "swaylock"
fi
#timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
if [[ $1 == "-k" ]]; then
killall swayidle
exit 0
fi
if [[ $1 != "-k" ]]; then
echo 'wrong syntax, do idle or idle -k'
fi