aboutsummaryrefslogtreecommitdiffstats
path: root/community/pipewire/pipewire-launcher.sh
blob: 95dcd5efc2c419d4d6d080133e1410da97fd2b82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# We need to kill any existing pipewire instance to restore sound
pkill -u "${USER}" -x pipewire 1>/dev/null 2>&1
pkill -u "${USER}" -fx "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

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 pipewire -c pipewire-pulse.conf &