dotfiles/dot_local/bin/executable_waybar-launcher

20 lines
480 B
Bash

#!/bin/sh
user=$(id -u)
time=$(date +"%b %d, %Y %T")
log_file=$XDG_STATE_HOME/waybar.log
echo "--- $time ---" > "$log_file"
# Terminate already running bar instances
killall -q waybar
# Wait until the processes have been shut down
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 "$user" -x pipewire-pulse >/dev/null; do sleep 1; done
# Launch Waybar
waybar 2>&1 | tee -a "$log_file" &