dotfiles/dot_local/bin/executable_swayidle-laptop

29 lines
897 B
Bash

#!/bin/bash
START_TIME=`date +"%b %d, %Y %T"`
#LOG_FILE_DIM="${XDG_STATE_HOME}"/swayidle-dim.log
LOG_FILE_LOCK="${XDG_STATE_HOME}"/swayidle.log
#echo "--- ${START_TIME} ---" > "$LOG_FILE_DIM"
echo "--- ${START_TIME} ---" > "$LOG_FILE_LOCK"
# kill running processes
killall -q swayidle
# dim screen after 2 minutes, lock after 5, turn off after 15, suspend after 60
#swayidle -w \
# timeout 120 'light -O && light -S .1' \
# resume 'light -I' \
# 2>&1 | tee -a "$LOG_FILE_DIM" & disown
swayidle -w \
timeout 120 'light -O && light -S .1' \
resume 'light -I' \
timeout 300 'waylock-launcher' \
resume 'light -I' \
timeout 900 'light -I && wlr-randr --output eDP-1 --off' \
resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \
timeout 3600 'loginctl suspend' \
resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \
2>&1 | "$LOG_FILE_LOCK" & disown