dotfiles/dot_local/bin/executable_pipewire-launcher

29 lines
919 B
Text
Raw Permalink Normal View History

2024-02-19 20:49:12 -05:00
#!/bin/sh
2023-01-24 15:10:27 -05:00
2024-02-19 20:49:12 -05:00
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
2023-06-17 00:03:57 -04:00
2024-02-19 20:49:12 -05:00
echo "--- $time ---" > "$wire_log"
echo "--- $time ---" > "$pipe_log"
echo "--- $time ---" > "$pulse_log"
2023-06-17 00:03:57 -04:00
2023-01-24 15:10:27 -05:00
# Kill any running pipewire processes
killall -q wireplumber & killall -q pipewire-pulse & killall -q pipewire
# Wait for processes to stop
2024-02-19 20:49:12 -05:00
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
2023-01-24 15:10:27 -05:00
2023-04-12 00:35:32 -04:00
# Wait for xdg-desktop-portal to start
2024-02-19 20:49:12 -05:00
until pgrep -u "$user" -f /usr/lib/xdg-desktop-portal >/dev/null; do sleep 1; done
2023-04-12 00:35:32 -04:00
2023-01-24 15:10:27 -05:00
# Launch pipewire
2024-02-19 20:49:12 -05:00
/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" &
2023-01-24 15:10:27 -05:00