From 488118888d4e75ed8dd4b6551b321ca26bd38791 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Sat, 17 Jun 2023 05:00:33 -0400 Subject: [PATCH] Update and template wayland idle/lock scripts --- dot_config/river/executable_init.tmpl | 21 +++++------ dot_local/bin/executable_swayidle-laptop | 29 --------------- .../bin/executable_swayidle-launcher.tmpl | 35 +++++++++++++++++++ dot_local/bin/executable_waylock-launcher | 9 ++--- 4 files changed, 49 insertions(+), 45 deletions(-) delete mode 100644 dot_local/bin/executable_swayidle-laptop create mode 100644 dot_local/bin/executable_swayidle-launcher.tmpl diff --git a/dot_config/river/executable_init.tmpl b/dot_config/river/executable_init.tmpl index 1fad88e..5eade43 100644 --- a/dot_config/river/executable_init.tmpl +++ b/dot_config/river/executable_init.tmpl @@ -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=secrets & gnome-keyring-daemon --start --components=ssh & -pipewire-launcher & kanshi & -dunst & -{{- if eq .chezmoi.hostname "hydrus" }} -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 & +pipewire-launcher & +swayidle-launcher & waybar-launcher & +dunst & +gammastep -r & 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 & evolution & mattermost-desktop & diff --git a/dot_local/bin/executable_swayidle-laptop b/dot_local/bin/executable_swayidle-laptop deleted file mode 100644 index d8bcfd2..0000000 --- a/dot_local/bin/executable_swayidle-laptop +++ /dev/null @@ -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 - diff --git a/dot_local/bin/executable_swayidle-launcher.tmpl b/dot_local/bin/executable_swayidle-launcher.tmpl new file mode 100644 index 0000000..1199f6c --- /dev/null +++ b/dot_local/bin/executable_swayidle-launcher.tmpl @@ -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 }} diff --git a/dot_local/bin/executable_waylock-launcher b/dot_local/bin/executable_waylock-launcher index ed6ad7e..9cbbbf0 100644 --- a/dot_local/bin/executable_waylock-launcher +++ b/dot_local/bin/executable_waylock-launcher @@ -1,7 +1,8 @@ #!/bin/bash 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 exit 1 @@ -9,8 +10,8 @@ else waylock \ -fork-on-lock \ -init-color 0x000000 \ - -input-color 0x323d43 \ - -fail-color 0xe26c6e \ - 2>&1 | tee -a "${XDG_STATE_HOME}"/waylock.log & disown + -fail-color 0x000000 \ + -input-color 0x525c62 \ + 2>&1 | tee -a "$LOG_FILE" & disown fi