mirror of
https://codeberg.org/andyscott/dotfiles.git
synced 2024-12-22 18:03:11 -05:00
Compare commits
No commits in common. "3fc10d15b74882a3c1fb66be2f2a5874543cc9d3" and "6ee3946a3d435473f6aef02f8b3d56ce3764742e" have entirely different histories.
3fc10d15b7
...
6ee3946a3d
2 changed files with 17 additions and 20 deletions
|
@ -1,34 +1,33 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if test -n "$XDG_STATE_HOME"; then
|
if test -n "$XDG_STATE_HOME"; then
|
||||||
log_dir=$XDG_STATE_HOME
|
log_file=$XDG_STATE_HOME/idle.log
|
||||||
else
|
else
|
||||||
log_dir=$HOME/.local/state
|
log_file=$HOME/.local/state/idle.log
|
||||||
fi
|
fi
|
||||||
|
echo "--- $(date +"%Y-%m-%d %T") ---" > "$log_file"
|
||||||
log_file=$log_dir/idle.log
|
|
||||||
echo "--- idle-launcher $(date +"%Y-%m-%d %T") ---" > "$log_file"
|
|
||||||
|
|
||||||
# kill process if already running
|
# kill process if already running
|
||||||
user=$(id -u)
|
user=$(id -u)
|
||||||
pid=$(ps -o pid,comm -u "$user" | awk '$2=="swayidle" {print $1}')
|
pid=$(ps -o pid,comm -u "$user" | awk '$2=="swayidle" {print $1}')
|
||||||
if [ "$pid" != "" ]; then
|
if [ "$pid" != "" ]; then
|
||||||
echo "$(date +"%Y-%m-%d %T") - idle-launcher: Sending SIGTERM" >> "$log_file"
|
echo "Restarting... Sending SIGTERM." >> "$log_file"
|
||||||
kill "$pid"
|
kill "$pid"
|
||||||
sleep 1
|
sleep 1
|
||||||
pid=$(ps -o pid,comm -p "$pid" | awk '$2=="swayidle" {print $1}')
|
fi
|
||||||
if [ "$pid" != "" ]; then
|
|
||||||
echo "$(date +"%Y-%m-%d %T") - idle-launcher: Sending SIGKILL" >> "$log_file"
|
pid=$(ps -o pid,comm -p "$pid" | awk '$2=="swayidle" {print $1}')
|
||||||
kill -9 "$pid"
|
if [ "$pid" != "" ]; then
|
||||||
sleep 1
|
echo "Restarting... Sending SIGKILL." >> "$log_file"
|
||||||
fi
|
kill -9 "$pid"
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{{ if eq .chezmoi.hostname "helix" -}}
|
{{ if eq .chezmoi.hostname "helix" -}}
|
||||||
# dim: 2m, lock: 5m, display: 15m, suspend: 1h
|
# dim: 2m, lock: 5m, display: 15m, suspend: 1h
|
||||||
brightness=/sys/class/backlight/amdgpu_bl1/brightness
|
brightness="/sys/class/backlight/amdgpu_bl1/brightness"
|
||||||
prev_brightness=$log_dir/prev_brightness
|
prev_brightness="${XDG_STATE_HOME}/prev_brightness"
|
||||||
swayidle -dw \
|
swayidle -w \
|
||||||
timeout 120 "cat $brightness > $prev_brightness && echo 0 > $brightness" \
|
timeout 120 "cat $brightness > $prev_brightness && echo 0 > $brightness" \
|
||||||
resume "cat $prev_brightness > $brightness" \
|
resume "cat $prev_brightness > $brightness" \
|
||||||
timeout 300 'waylock-launcher' \
|
timeout 300 'waylock-launcher' \
|
||||||
|
@ -42,7 +41,7 @@ swayidle -dw \
|
||||||
2>&1 | tee -a "$log_file" &
|
2>&1 | tee -a "$log_file" &
|
||||||
{{- else if eq .chezmoi.hostname "hydrus" }}
|
{{- else if eq .chezmoi.hostname "hydrus" }}
|
||||||
# lock: 5m, display: 15m
|
# lock: 5m, display: 15m
|
||||||
swayidle -dw \
|
swayidle -w \
|
||||||
timeout 300 'waylock-launcher' \
|
timeout 300 'waylock-launcher' \
|
||||||
timeout 900 'kanshictl switch dual-off' \
|
timeout 900 'kanshictl switch dual-off' \
|
||||||
resume 'kanshictl switch dual' \
|
resume 'kanshictl switch dual' \
|
||||||
|
@ -51,7 +50,7 @@ swayidle -dw \
|
||||||
2>&1 | tee -a "$log_file" &
|
2>&1 | tee -a "$log_file" &
|
||||||
{{- else }}
|
{{- else }}
|
||||||
# lock after 5m
|
# lock after 5m
|
||||||
swayidle -dw \
|
swayidle -w \
|
||||||
timeout 300 'waylock-launcher' \
|
timeout 300 'waylock-launcher' \
|
||||||
2>&1 | tee -a "$log_file" &
|
2>&1 | tee -a "$log_file" &
|
||||||
{{- end }}
|
{{ end }}
|
||||||
|
|
|
@ -12,8 +12,6 @@ if pgrep -u "$user" -x waylock >/dev/null; then
|
||||||
else
|
else
|
||||||
waylock \
|
waylock \
|
||||||
-fork-on-lock \
|
-fork-on-lock \
|
||||||
-log-level debug \
|
|
||||||
-ignore-empty-password \
|
|
||||||
-init-color 0x000000 \
|
-init-color 0x000000 \
|
||||||
-fail-color 0x000000 \
|
-fail-color 0x000000 \
|
||||||
-input-color 0x525c62 \
|
-input-color 0x525c62 \
|
||||||
|
|
Loading…
Reference in a new issue