Files
euri-packages/packages/pipewire/artix-pipewire-launcher
T
c-ludenberg ed813487cb fork pipewire with dinit support in artix-pipewire-launcher
Fork pipewire 1:1.6.7-1 from Artix world repo with a patched
artix-pipewire-launcher that sets SUPPORT='YES' for dinit.

Previously the launcher treated dinit as unsupported (alongside
openrc), which broke XDG autostart of pipewire.desktop on
dinit-based systems. Users were told to use dinitctl instead.
This patch enables direct XDG autostart on dinit by changing:
  dinit|openrc)  SUPPORT='' ;;
to:
  openrc)  SUPPORT='' ;;
  dinit|runit|s6) SUPPORT='YES' ;;

Add pipewire to packages.yaml so CI picks it up.
2026-07-10 22:17:59 +02:00

84 lines
2.6 KiB
Bash

#!/bin/sh
# WARNING: This script assumes being run inside XDG compliant session,
# which means D-Bus session instance is expected to be correctly set up
# prior to this script starting. If that is not true, things may break!
DATE_FORMAT='+%Y-%m-%dT%H:%M:%S%Z'
for init in dinit openrc runit s6; do
[[ -f /sbin/$init-init ]] && case $init in
openrc) SUPPORT='' ;;
dinit|runit|s6) SUPPORT='YES' ;;
esac && break
done
[ $SUPPORT ] || { echo "Unsupported method; use the service manager (rc-service/dinitctl) to control PipeWire."; exit 1; }
startpw() {
# The core daemon which by itself does probably nothing.
echo "[$(date "${DATE_FORMAT}")] Starting PipeWire." 1>>"${ARTIX_PIPEWIRE_LOG}"
echo -n "Starting PipeWire... "
/usr/bin/pipewire 1>>"${ARTIX_PIPEWIRE_LOG}" 2>&1 &
# The so called pipewire-pulse daemon used for PulseAudio compatibility.
# Commenting this out will stop the PA proxying daemon from starting,
# however ALSA (with pipewire-alsa), JACK (with jack-sdk) and PW API using
# clients will still have access to audio and may end up clashing with
# non-PW apps over HW control (most notably, /usr/bin/pulseaudio daemon).
echo "[$(date "${DATE_FORMAT}")] Starting PipeWire-Pulse." 1>>"${ARTIX_PIPEWIRE_PULSE_LOG}"
echo -n "PipeWire-Pulse... "
/usr/bin/pipewire -c pipewire-pulse.conf 1>>"${ARTIX_PIPEWIRE_PULSE_LOG}" 2>&1 &
# Hack for bug #822498
sleep 1
# Finally a session manager is required for PipeWire to do anything
echo "[$(date "${DATE_FORMAT}")] Starting WirePlumber." 1>>"${ARTIX_WIREPLUMBER_LOG}"
echo -n "WirePlumber... "
/usr/bin/wireplumber 1>>"${ARTIX_WIREPLUMBER_LOG}" 2>&1 &
echo "done!"
}
restart() {
echo -n "Terminating PipeWire processes... "
pkill -9 -u "${USER}" -x "pipewire|wireplumber" 1>/dev/null 2>&1
pidwait -u "${USER}" -x "pipewire|wireplumber" 2>/dev/null || sleep 1
echo "terminated."
startpw
}
CONF="${XDG_CONFIG_HOME}/artix-pipewire-launcher.conf"
if [ -f "${CONF}" ]; then
. "${CONF}"
else
ARTIX_PIPEWIRE_LOG='/dev/null'
ARTIX_PIPEWIRE_PULSE_LOG='/dev/null'
ARTIX_WIREPLUMBER_LOG='/dev/null'
fi
for L in \
"${ARTIX_PIPEWIRE_LOG}" \
"${ARTIX_PIPEWIRE_PULSE_LOG}" \
"${ARTIX_WIREPLUMBER_LOG}"; do
if [ ! -e "${L}" ]; then
touch "${L}"
fi
done
pwpid=$(pgrep -u "${USER}" -x "pipewire")
wppid=$(pgrep -u "${USER}" -x "wireplumber")
[[ ! -z "$pwpid$wppid" && "${1}" != "restart" ]] && { echo "PipeWire/WirePlumber already running."; exit 0; }
[ -z "${1}" ] && startpw
if [ "${#}" -gt 0 ]; then
if [ "${1}" = 'restart' ]; then
restart
else
echo "Unrecognised argument." >&2
echo "Usage: artix-pipewire-launcher [restart]" >&2
exit 1
fi
fi