dotfiles/dot_local/bin/executable_swayidle-launcher.tmpl

40 lines
1.1 KiB
Cheetah
Raw Normal View History

2024-02-19 20:49:12 -05:00
#!/bin/sh
2024-02-19 20:49:12 -05:00
time=$(date +"%b %d, %Y %T")
log_file=$XDG_STATE_HOME/swayidle.log
2024-02-19 20:49:12 -05:00
echo "--- $time ---" > "$log_file"
# kill running processes
killall -q swayidle
2023-06-18 00:04:32 -04:00
{{ 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' \
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" &
{{- 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" &
{{- else }}
# lock after 5m
swayidle -w \
timeout 300 'waylock-launcher' \
2024-02-19 20:49:12 -05:00
2>&1 | tee -a "$log_file" &
{{ end }}