From d1f95edd2048ea7984705ab7ce000ead98d52feb Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Sat, 17 Jun 2023 00:03:57 -0400 Subject: [PATCH] Update startup script logging --- .../bin/executable_dual-polybar-launcher | 17 ++++++--- dot_local/bin/executable_pipewire-launcher | 16 ++++++-- .../bin/executable_single-polybar-launcher | 9 +++-- dot_local/bin/executable_swayidle-laptop | 38 ++++++++++++------- dot_local/bin/executable_tint2-launcher | 8 +++- dot_local/bin/executable_waybar-launcher | 8 +++- dot_local/bin/executable_xidlehook-desktop | 14 +++++-- dot_local/bin/executable_xidlehook-laptop | 18 ++++++--- 8 files changed, 89 insertions(+), 39 deletions(-) diff --git a/dot_local/bin/executable_dual-polybar-launcher b/dot_local/bin/executable_dual-polybar-launcher index 7c14a05..01fcb14 100644 --- a/dot_local/bin/executable_dual-polybar-launcher +++ b/dot_local/bin/executable_dual-polybar-launcher @@ -1,14 +1,21 @@ #!/bin/bash +START_TIME=`date +"%b %d, %Y %T"` +LOG_FILE_BAR1="${XDG_STATE_HOME}"/polybar1.log +LOG_FILE_BAR2="${XDG_STATE_HOME}"/polybar2.log + +echo "--- ${START_TIME} ---" > "$LOG_FILE_BAR1" +echo "--- ${START_TIME} ---" > "$LOG_FILE_BAR2" + # Terminate already running bar instances -killall -q polybar +#killall -q polybar # needed if ipc disabled +polybar-msg cmd quit # Wait until the processes have been shut down while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done -# Launch Polybar, using default config location ~/.config/polybar/config -echo "---" | tee -a /tmp/polybar1.log /tmp/polybar2.log -polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a /tmp/polybar1.log & disown -polybar two -r --config=~/.config/polybar/config.ini 2>&1 | tee -a /tmp/polybar2.log & disown +# Launch Polybar +polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a "$LOG_FILE_BAR1" & disown +polybar two -r --config=~/.config/polybar/config.ini 2>&1 | tee -a "$LOG_FILE_BAR2" & disown echo "Polybar launched..." diff --git a/dot_local/bin/executable_pipewire-launcher b/dot_local/bin/executable_pipewire-launcher index 2eb3a80..9a6036d 100644 --- a/dot_local/bin/executable_pipewire-launcher +++ b/dot_local/bin/executable_pipewire-launcher @@ -1,5 +1,14 @@ #!/bin/bash +START_TIME=`date +"%b %d, %Y %T"` +LOG_FILE_WIRE="${XDG_STATE_HOME}"/wireplumber.log +LOG_FILE_PIPE="${XDG_STATE_HOME}"/pipewire.log +LOG_FILE_PULSE="${XDG_STATE_HOME}"/pipewire-pulse.log + +echo "--- ${START_TIME} ---" > "$LOG_FILE_WIRE" +echo "--- ${START_TIME} ---" > "$LOG_FILE_PIPE" +echo "--- ${START_TIME} ---" > "$LOG_FILE_PULSE" + # Kill any running pipewire processes killall -q wireplumber & killall -q pipewire-pulse & killall -q pipewire @@ -12,8 +21,7 @@ while pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done until pgrep -u $UID -f /usr/lib/xdg-desktop-portal >/dev/null; do sleep 1; done # Launch pipewire -echo "---" | tee -a /tmp/{wireplumber.log,pipewire.log,pipewire-pulse.log} -/usr/bin/wireplumber 2>&1 | tee -a /tmp/wireplumber.log & disown -/usr/bin/pipewire 2>&1 | tee -a /tmp/pipewire.log & disown -/usr/bin/pipewire-pulse 2>&1 | tee -a /tmp/pipewire-pulse.log & disown +/usr/bin/wireplumber 2>&1 | tee -a "$LOG_FILE_WIRE" & disown +/usr/bin/pipewire 2>&1 | tee -a "$LOG_FILE_PIPE" & disown +/usr/bin/pipewire-pulse 2>&1 | tee -a "$LOG_FILE_PULSE" & disown diff --git a/dot_local/bin/executable_single-polybar-launcher b/dot_local/bin/executable_single-polybar-launcher index 73b2814..fa8507b 100644 --- a/dot_local/bin/executable_single-polybar-launcher +++ b/dot_local/bin/executable_single-polybar-launcher @@ -1,5 +1,10 @@ #!/bin/bash +START_TIME=`date +"%b %d, %Y %T"` +LOG_FILE="${XDG_STATE_HOME}"/polybar.log + +echo "--- ${START_TIME} ---" > "$LOG_FILE" + # Terminate already running bar instances #killall -q polybar # needed if ipc disabled polybar-msg cmd quit @@ -8,7 +13,5 @@ polybar-msg cmd quit while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done # Launch Polybar -echo "---" | tee -a /tmp/polybar.log -polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a /tmp/polybar.log & disown +polybar one -r --config=~/.config/polybar/config.ini 2>&1 | tee -a "$LOG_FILE" & disown -echo "Polybar launched..." diff --git a/dot_local/bin/executable_swayidle-laptop b/dot_local/bin/executable_swayidle-laptop index 331b096..cb9cad3 100644 --- a/dot_local/bin/executable_swayidle-laptop +++ b/dot_local/bin/executable_swayidle-laptop @@ -1,17 +1,29 @@ #!/bin/bash -# dim screen after 2 minutes, turn screen off after 10, suspend after an hour -echo "---" | tee -a /tmp/swayidle-dim.log -swayidle -w \ - timeout 120 "light -O && light -S .1" \ - resume "light -I" \ - 2>&1 | tee -a /tmp/swayidle-dim.log & disown +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 "---" | tee -a /tmp/swayidle.log -swayidle -w \ - timeout 600 "wlr-randr --output eDP-1 --off" \ - timeout 3600 "loginctl suspend" \ - resume "wlr-randr --output eDP-1 --on" \ - before-sleep "if ![[ pgrep -x waylock ]]; then waylock -fork-on-lock -init-color 0x000000; fi" \ - 2>&1 | tee -a /tmp/swayidle.log & disown +#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' \ + resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \ + 2>&1 | "$LOG_FILE_LOCK" & disown diff --git a/dot_local/bin/executable_tint2-launcher b/dot_local/bin/executable_tint2-launcher index df704a6..9f5d64b 100644 --- a/dot_local/bin/executable_tint2-launcher +++ b/dot_local/bin/executable_tint2-launcher @@ -1,5 +1,10 @@ #!/bin/bash +START_TIME=`date +"%b %d, %Y %T"` +LOG_FILE="${XDG_STATE_HOME}"/tint2.log + +echo "--- ${START_TIME} ---" > "$LOG_FILE" + # Terminate already running bar instances killall -q tint2 @@ -7,8 +12,7 @@ killall -q tint2 while pgrep -u $UID -x tint2 >/dev/null; do sleep 1; done # Launch tint2 -echo "---" | tee -a /tmp/tint2.log -tint2 2>&1 | tee -a /tmp/tint2.log & disown +tint2 2>&1 | tee -a "$LOG_FILE" & disown # Final command won't work without sleep sleep 1 && diff --git a/dot_local/bin/executable_waybar-launcher b/dot_local/bin/executable_waybar-launcher index 4f57801..e27042e 100644 --- a/dot_local/bin/executable_waybar-launcher +++ b/dot_local/bin/executable_waybar-launcher @@ -1,5 +1,10 @@ #!/bin/bash +START_TIME=`date +"%b %d, %Y %T"` +LOG_FILE="${XDG_STATE_HOME}"/waybar.log + +echo "--- ${START_TIME} ---" > "$LOG_FILE" + # Terminate already running bar instances killall -q waybar @@ -10,6 +15,5 @@ while pgrep -u $UID -x waybar >/dev/null; do sleep 1; done until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done # Launch Waybar -echo "---" | tee -a /tmp/waybar.log -waybar 2>&1 | tee -a /tmp/waybar.log & disown +waybar 2>&1 | tee -a "$LOG_FILE" & disown diff --git a/dot_local/bin/executable_xidlehook-desktop b/dot_local/bin/executable_xidlehook-desktop index f151044..a0d4246 100644 --- a/dot_local/bin/executable_xidlehook-desktop +++ b/dot_local/bin/executable_xidlehook-desktop @@ -1,10 +1,16 @@ #!/bin/bash +START_TIME=`date +"%b %d, %Y %T"` +LOG_FILE="${XDG_STATE_HOME}"/xidlehook.log + +echo "--- ${START_TIME} ---" > "$LOG_FILE" + # Wait on pipewire or "--not-when-audio" will break everything until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done # lock screen after 10 minutes -echo "---" | tee -a /tmp/xidlehook.log -xidlehook --not-when-audio --not-when-fullscreen \ - --timer 600 "xset s activate" "" \ - 2>&1 | tee -a /tmp/xidlehook.log & disown +xidlehook \ + --not-when-audio \ + --not-when-fullscreen \ + --timer 600 'xset s activate' '' \ + 2>&1 | tee -a "$LOG_FILE" & disown diff --git a/dot_local/bin/executable_xidlehook-laptop b/dot_local/bin/executable_xidlehook-laptop index 13bd6f2..79a998c 100644 --- a/dot_local/bin/executable_xidlehook-laptop +++ b/dot_local/bin/executable_xidlehook-laptop @@ -1,12 +1,18 @@ #!/bin/bash +START_TIME=`date +"%b %d, %Y %T"` +LOG_FILE="${XDG_STATE_HOME}"/xidlehook.log + +echo "--- ${START_TIME} ---" > "$LOG_FILE" + # Wait on pipewire or "--not-when-audio" will break everything until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done # dim screen after 2 minutes, lock screen after 10, suspend after an hour -echo "---" | tee -a /tmp/xidlehook.log -xidlehook --not-when-audio --not-when-fullscreen \ - --timer 120 "killall -q redshift && xrandr --output eDP-1 --brightness .1" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \ - --timer 480 "xset s activate" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \ - --timer 3000 "loginctl suspend" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" \ - 2>&1 | tee -a /tmp/xidlehook.log & disown +xidlehook \ + --not-when-audio \ + --not-when-fullscreen \ + --timer 120 'killall -q redshift && xrandr --output eDP-1 --brightness .1' 'xrandr --output eDP-1 --brightness 1 && redshift -r & disown' \ + --timer 480 'xset s activate' 'xrandr --output eDP-1 --brightness 1 && redshift -r & disown' \ + --timer 3000 'loginctl suspend' 'xrandr --output eDP-1 --brightness 1 && redshift -r & disown' \ + 2>&1 | tee -a "$LOG_FILE" & disown