dotfiles/dot_local/bin/executable_waybar-launcher

21 lines
480 B
Text
Raw Permalink Normal View History

2024-02-19 20:49:12 -05:00
#!/bin/sh
2023-06-16 00:44:03 -04:00
2024-02-19 20:49:12 -05:00
user=$(id -u)
time=$(date +"%b %d, %Y %T")
log_file=$XDG_STATE_HOME/waybar.log
2023-06-17 00:03:57 -04:00
2024-02-19 20:49:12 -05:00
echo "--- $time ---" > "$log_file"
2023-06-17 00:03:57 -04:00
2023-06-16 00:44:03 -04:00
# Terminate already running bar instances
killall -q waybar
# Wait until the processes have been shut down
2024-02-19 20:49:12 -05:00
while pgrep -u "$user" -x waybar >/dev/null; do sleep 1; done
2023-06-16 00:44:03 -04:00
# Make sure pipewire-pulse is running or module won't load
2024-02-19 20:49:12 -05:00
until pgrep -u "$user" -x pipewire-pulse >/dev/null; do sleep 1; done
2023-06-16 00:44:03 -04:00
# Launch Waybar
2024-02-19 20:49:12 -05:00
waybar 2>&1 | tee -a "$log_file" &
2023-06-16 00:44:03 -04:00