Update and template wayland idle/lock scripts

This commit is contained in:
Andrew Scott 2023-06-17 05:00:33 -04:00
parent d4949b784e
commit 488118888d
Signed by: a
GPG key ID: 7CD5A5977E4931C1
4 changed files with 49 additions and 45 deletions

View file

@ -199,21 +199,18 @@ rivertile -view-padding 4 -outer-padding 4 -main-ratio .5 &
gnome-keyring-daemon --start --components=pkcs11 & gnome-keyring-daemon --start --components=pkcs11 &
gnome-keyring-daemon --start --components=secrets & gnome-keyring-daemon --start --components=secrets &
gnome-keyring-daemon --start --components=ssh & gnome-keyring-daemon --start --components=ssh &
pipewire-launcher &
kanshi & kanshi &
dunst & pipewire-launcher &
{{- if eq .chezmoi.hostname "hydrus" }} swayidle-launcher &
swaybg -m fill -i $HOME/Pictures/Wallpapers/dark-forest-path.jpg &
swayidle -w timeout 300 'waylock-launcher' &
{{- else if eq .chezmoi.hostname "helix" }}
swaybg -m center -i "$HOME/Pictures/Wallpapers/Mountain Retreat.jpg" &
swayidle-laptop &
{{- else }}
swayidle -w timeout 300 'waylock-launcher' &
{{- end }}
gammastep -r &
waybar-launcher & waybar-launcher &
dunst &
gammastep -r &
river-tag-overlay & river-tag-overlay &
{{- if eq .chezmoi.hostname "hydrus" }}
swaybg -m fill -i ${HOME}/Pictures/Wallpapers/dark-forest-path.jpg &
{{- else if eq .chezmoi.hostname "helix" }}
swaybg -m center -i "${HOME}/Pictures/Wallpapers/Mountain Retreat.jpg" &
{{- end }}
blueman-applet & blueman-applet &
evolution & evolution &
mattermost-desktop & mattermost-desktop &

View file

@ -1,29 +0,0 @@
#!/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-then-hibernate' \
resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \
2>&1 | "$LOG_FILE_LOCK" & disown

View file

@ -0,0 +1,35 @@
#!/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' \
2>&1 | "$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 && kanshictl reload' \
2>&1 | "$LOG_FILE" & disown
{{- else }}
# lock after 5m
swayidle -w \
timeout 300 'waylock-launcher' \
2>&1 | "$LOG_FILE" & disown
{{ end }}

View file

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
START_TIME=`date +"%b %d, %Y %T"` START_TIME=`date +"%b %d, %Y %T"`
echo "--- ${START_TIME} ---" > "${XDG_STATE_HOME}"/waylock.log LOG_FILE="${XDG_STATE_HOME}"/waylock.log
echo "--- ${START_TIME} ---" > "$LOG_FILE"
if pgrep -u $UID -x waylock >/dev/null; then if pgrep -u $UID -x waylock >/dev/null; then
exit 1 exit 1
@ -9,8 +10,8 @@ else
waylock \ waylock \
-fork-on-lock \ -fork-on-lock \
-init-color 0x000000 \ -init-color 0x000000 \
-input-color 0x323d43 \ -fail-color 0x000000 \
-fail-color 0xe26c6e \ -input-color 0x525c62 \
2>&1 | tee -a "${XDG_STATE_HOME}"/waylock.log & disown 2>&1 | tee -a "$LOG_FILE" & disown
fi fi