mirror of
https://codeberg.org/andyscott/dotfiles.git
synced 2024-11-09 14:00:47 -05:00
39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
START_TIME=`date +"%b %d, %Y %T"`
|
|
LOG_FILE="${XDG_STATE_HOME}"/swayidle.log
|
|
|
|
echo "--- ${START_TIME} ---" > "$LOG_FILE"
|
|
|
|
# kill running processes
|
|
killall -q swayidle
|
|
|
|
{{ if eq .chezmoi.hostname "helix" -}}
|
|
# dim: 2m, lock: 5m, display: 15m, suspend: 1h
|
|
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-then-hibernate' \
|
|
resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \
|
|
lock 'waylock-launcher' \
|
|
before-sleep 'waylock-launcher' \
|
|
2>&1 | tee -a "$LOG_FILE" & disown
|
|
{{- else if eq .chezmoi.hostname "hydrus" }}
|
|
# lock: 5m, display: 15m
|
|
swayidle -w \
|
|
timeout 300 'waylock-launcher' \
|
|
timeout 900 'wlr-randr --output DP-1 --off --output DP-2 --off' \
|
|
resume 'wlr-randr --output DP-1 --on --output DP-2 --on && sleep 2 && kanshictl reload' \
|
|
lock 'waylock-launcher' \
|
|
before-sleep 'waylock-launcher' \
|
|
2>&1 | tee -a "$LOG_FILE" & disown
|
|
{{- else }}
|
|
# lock after 5m
|
|
swayidle -w \
|
|
timeout 300 'waylock-launcher' \
|
|
2>&1 | tee -a "$LOG_FILE" & disown
|
|
{{ end }}
|