2024-02-19 20:49:12 -05:00
|
|
|
#!/bin/sh
|
2023-06-17 05:00:33 -04:00
|
|
|
|
2024-02-19 20:49:12 -05:00
|
|
|
time=$(date +"%b %d, %Y %T")
|
|
|
|
log_file=$XDG_STATE_HOME/swayidle.log
|
2023-06-17 05:00:33 -04:00
|
|
|
|
2024-02-19 20:49:12 -05:00
|
|
|
echo "--- $time ---" > "$log_file"
|
2023-06-17 05:00:33 -04:00
|
|
|
|
|
|
|
# kill running processes
|
|
|
|
killall -q swayidle
|
|
|
|
|
2023-06-18 00:04:32 -04:00
|
|
|
{{ if eq .chezmoi.hostname "helix" -}}
|
2023-06-17 05:00:33 -04:00
|
|
|
# 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' \
|
2023-07-14 01:04:28 -04:00
|
|
|
lock 'waylock-launcher' \
|
|
|
|
before-sleep 'waylock-launcher' \
|
2024-02-19 20:49:12 -05:00
|
|
|
2>&1 | tee -a "$log_file" &
|
2023-06-17 05:00:33 -04:00
|
|
|
{{- else if eq .chezmoi.hostname "hydrus" }}
|
|
|
|
# lock: 5m, display: 15m
|
|
|
|
swayidle -w \
|
|
|
|
timeout 300 'waylock-launcher' \
|
2024-02-19 20:49:12 -05:00
|
|
|
timeout 900 'kanshictl switch dual-off' \
|
|
|
|
resume 'kanshictl switch dual' \
|
2023-07-14 01:04:28 -04:00
|
|
|
lock 'waylock-launcher' \
|
|
|
|
before-sleep 'waylock-launcher' \
|
2024-02-19 20:49:12 -05:00
|
|
|
2>&1 | tee -a "$log_file" &
|
2023-06-17 05:00:33 -04:00
|
|
|
{{- else }}
|
|
|
|
# lock after 5m
|
|
|
|
swayidle -w \
|
|
|
|
timeout 300 'waylock-launcher' \
|
2024-02-19 20:49:12 -05:00
|
|
|
2>&1 | tee -a "$log_file" &
|
2023-06-17 05:00:33 -04:00
|
|
|
{{ end }}
|