diff --git a/dot_local/bin/executable_pipewire-launcher b/dot_local/bin/executable_pipewire-launcher index 9a6036d..6870778 100644 --- a/dot_local/bin/executable_pipewire-launcher +++ b/dot_local/bin/executable_pipewire-launcher @@ -1,27 +1,28 @@ -#!/bin/bash +#!/bin/sh -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 +user=$(id -u) +time=$(date +"%b %d, %Y %T") +wire_log=$XDG_STATE_HOME/wireplumber.log +pipe_log=$XDG_STATE_HOME/pipewire.log +pulse_log=$XDG_STATE_HOME/pipewire-pulse.log -echo "--- ${START_TIME} ---" > "$LOG_FILE_WIRE" -echo "--- ${START_TIME} ---" > "$LOG_FILE_PIPE" -echo "--- ${START_TIME} ---" > "$LOG_FILE_PULSE" +echo "--- $time ---" > "$wire_log" +echo "--- $time ---" > "$pipe_log" +echo "--- $time ---" > "$pulse_log" # Kill any running pipewire processes killall -q wireplumber & killall -q pipewire-pulse & killall -q pipewire # Wait for processes to stop -while pgrep -u $UID -x wireplumber >/dev/null; do sleep 1; done -while pgrep -u $UID -x pipewire >/dev/null; do sleep 1; done -while pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done +while pgrep -u "$user" -x wireplumber >/dev/null; do sleep 1; done +while pgrep -u "$user" -x pipewire >/dev/null; do sleep 1; done +while pgrep -u "$user" -x pipewire-pulse >/dev/null; do sleep 1; done # Wait for xdg-desktop-portal to start -until pgrep -u $UID -f /usr/lib/xdg-desktop-portal >/dev/null; do sleep 1; done +until pgrep -u "$user" -f /usr/lib/xdg-desktop-portal >/dev/null; do sleep 1; done # Launch pipewire -/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 +/usr/bin/wireplumber 2>&1 | tee -a "$wire_log" & +/usr/bin/pipewire 2>&1 | tee -a "$pipe_log" & +/usr/bin/pipewire-pulse 2>&1 | tee -a "$pulse_log" & diff --git a/dot_local/bin/executable_river-logout b/dot_local/bin/executable_river-logout deleted file mode 100644 index b3480bc..0000000 --- a/dot_local/bin/executable_river-logout +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -RIVER=`ps -C river | awk '/river/'` - -[[ $RIVER != "" ]] && riverctl spawn 'reset' && riverctl exit || echo "River is not running." diff --git a/dot_local/bin/executable_swayidle-launcher.tmpl b/dot_local/bin/executable_swayidle-launcher.tmpl index ea5e69c..bec788d 100644 --- a/dot_local/bin/executable_swayidle-launcher.tmpl +++ b/dot_local/bin/executable_swayidle-launcher.tmpl @@ -1,9 +1,9 @@ -#!/bin/bash +#!/bin/sh -START_TIME=`date +"%b %d, %Y %T"` -LOG_FILE="${XDG_STATE_HOME}"/swayidle.log +time=$(date +"%b %d, %Y %T") +log_file=$XDG_STATE_HOME/swayidle.log -echo "--- ${START_TIME} ---" > "$LOG_FILE" +echo "--- $time ---" > "$log_file" # kill running processes killall -q swayidle @@ -21,19 +21,19 @@ swayidle -w \ resume 'wlr-randr --output eDP-1 --on && kanshictl reload' \ lock 'waylock-launcher' \ before-sleep 'waylock-launcher' \ - 2>&1 | tee -a "$LOG_FILE" & disown + 2>&1 | tee -a "$log_file" & {{- 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 && sleep 2 && kanshictl reload' \ + timeout 900 'kanshictl switch dual-off' \ + resume 'kanshictl switch dual' \ lock 'waylock-launcher' \ before-sleep 'waylock-launcher' \ - 2>&1 | tee -a "$LOG_FILE" & disown + 2>&1 | tee -a "$log_file" & {{- else }} # lock after 5m swayidle -w \ timeout 300 'waylock-launcher' \ - 2>&1 | tee -a "$LOG_FILE" & disown + 2>&1 | tee -a "$log_file" & {{ end }} diff --git a/dot_local/bin/executable_waybar-launcher b/dot_local/bin/executable_waybar-launcher index e27042e..2ed7cc5 100644 --- a/dot_local/bin/executable_waybar-launcher +++ b/dot_local/bin/executable_waybar-launcher @@ -1,19 +1,20 @@ -#!/bin/bash +#!/bin/sh -START_TIME=`date +"%b %d, %Y %T"` -LOG_FILE="${XDG_STATE_HOME}"/waybar.log +user=$(id -u) +time=$(date +"%b %d, %Y %T") +log_file=$XDG_STATE_HOME/waybar.log -echo "--- ${START_TIME} ---" > "$LOG_FILE" +echo "--- $time ---" > "$log_file" # Terminate already running bar instances killall -q waybar # Wait until the processes have been shut down -while pgrep -u $UID -x waybar >/dev/null; do sleep 1; done +while pgrep -u "$user" -x waybar >/dev/null; do sleep 1; done # Make sure pipewire-pulse is running or module won't load -until pgrep -u $UID -x pipewire-pulse >/dev/null; do sleep 1; done +until pgrep -u "$user" -x pipewire-pulse >/dev/null; do sleep 1; done # Launch Waybar -waybar 2>&1 | tee -a "$LOG_FILE" & disown +waybar 2>&1 | tee -a "$log_file" & diff --git a/dot_local/bin/executable_waylock-launcher b/dot_local/bin/executable_waylock-launcher index 9cbbbf0..d9d43a3 100644 --- a/dot_local/bin/executable_waylock-launcher +++ b/dot_local/bin/executable_waylock-launcher @@ -1,10 +1,13 @@ -#!/bin/bash +#!/bin/sh -START_TIME=`date +"%b %d, %Y %T"` -LOG_FILE="${XDG_STATE_HOME}"/waylock.log -echo "--- ${START_TIME} ---" > "$LOG_FILE" +user=$(id -u) +time=$(date +"%b %d, %Y %T") +log_file=$XDG_STATE_HOME/waylock.log -if pgrep -u $UID -x waylock >/dev/null; then +echo "--- $time ---" > "$log_file" + +if pgrep -u "$user" -x waylock >/dev/null; then + echo "error: waylock is already running" >> "$log_file" exit 1 else waylock \ @@ -12,6 +15,6 @@ else -init-color 0x000000 \ -fail-color 0x000000 \ -input-color 0x525c62 \ - 2>&1 | tee -a "$LOG_FILE" & disown + 2>&1 | tee -a "$log_file" fi diff --git a/dot_local/bin/executable_yambar-launcher.tmpl b/dot_local/bin/executable_yambar-launcher.tmpl index 83e277d..0d4924d 100644 --- a/dot_local/bin/executable_yambar-launcher.tmpl +++ b/dot_local/bin/executable_yambar-launcher.tmpl @@ -1,21 +1,25 @@ -#!/bin/bash +#!/bin/sh -START_TIME=`date +"%b %d, %Y %T"` -LOG_FILE_BAR1="${XDG_STATE_HOME}"/yambar1.log -echo "--- ${START_TIME} ---" > "$LOG_FILE_BAR1" +user=$(id -u) +time=$(date +"%b %d, %Y %T") +bar1_log=$XDG_STATE_HOME/yambar1.log {{- if eq .chezmoi.hostname "hydrus" }} -LOG_FILE_BAR2="${XDG_STATE_HOME}"/yambar2.log -echo "--- ${START_TIME} ---" > "$LOG_FILE_BAR2" +bar2_log=$XDG_STATE_HOME/yambar2.log +{{- end }} + +echo "--- $time ---" > "$bar1_log" +{{- if eq .chezmoi.hostname "hydrus" }} +echo "--- $time ---" > "$bar2_log" {{- end }} # Terminate already running bar instances killall -q yambar # Wait until the processes have been shut down -while pgrep -u $UID -x yambar >/dev/null; do sleep 1; done +while pgrep -u "$user" -x yambar >/dev/null; do sleep 1; done # Launch Yambar -yambar -s 2>&1 | tee -a "$LOG_FILE_BAR1" & disown +yambar -s 2>&1 | tee -a "$bar1_log" & {{- if eq .chezmoi.hostname "hydrus" }} -yambar -s -c "${XDG_CONFIG_HOME}/yambar/bar2.yml" 2>&1 | tee -a "$LOG_FILE_BAR2" & disown +yambar -s -c "$XDG_CONFIG_HOME/yambar/bar2.yml" 2>&1 | tee -a "$bar2_log" & {{- end }}