aports/community/pipewire/pipewire-launcher.sh
Pranjal Kole c877ba1b82 community/pipewire: kill previous instance before launch
/usr/bin/pipewire was not being killed previously.

The order in which the processes are killed has been
changed to avoid this error message from pipewire-media-session:

[W][77952.698669] ms.core      | [ media-session.c: 2211 core_error()] error id:0 seq:799 res:-32 (Broken pipe): connection error

Additionally, pipewire-pulse is now started with the /usr/bin/ prefix,
since a user may have another binary named pipewire in their $PATH.
2022-03-04 15:23:59 +00:00

23 lines
783 B
Bash

#!/bin/sh
# We need to kill any existing pipewire instance to restore sound
pkill -u "${USER}" -fx "/usr/bin/pipewire -c pipewire-pulse.conf" 1>/dev/null 2>&1
pkill -u "${USER}" -fx /usr/bin/pipewire-media-session 1>/dev/null 2>&1
pkill -u "${USER}" -fx /usr/bin/wireplumber 1>/dev/null 2>&1
pkill -u "${USER}" -fx /usr/bin/pipewire 1>/dev/null 2>&1
exec /usr/bin/pipewire &
# wait for pipewire to start before attempting to start related daemons
while [ "$(pgrep -f /usr/bin/pipewire)" = "" ]; do
sleep 1
done
if [ -x /usr/bin/wireplumber ]; then
exec /usr/bin/wireplumber &
elif [ -x /usr/bin/pipewire-media-session ]; then
exec /usr/bin/pipewire-media-session &
fi
[ -f "/usr/share/pipewire/pipewire-pulse.conf" ] && exec /usr/bin/pipewire -c pipewire-pulse.conf &