summaryrefslogtreecommitdiff
path: root/media-video/pipewire/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-09-12 04:40:07 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-09-12 04:40:07 +0100
commit5d5e56d92268c2b9b6ccc38eeaa3516ce9b1e8fd (patch)
tree587e467a631661f0e4786a584d79db3a9eeab5d7 /media-video/pipewire/files
parentf8399e5cf87087ab3b9f8b1ed2955c0bd5469a9b (diff)
gentoo auto-resync : 12:09:2023 - 04:40:07
Diffstat (limited to 'media-video/pipewire/files')
-rw-r--r--media-video/pipewire/files/gentoo-pipewire-launcher.in-r384
1 files changed, 84 insertions, 0 deletions
diff --git a/media-video/pipewire/files/gentoo-pipewire-launcher.in-r3 b/media-video/pipewire/files/gentoo-pipewire-launcher.in-r3
new file mode 100644
index 000000000000..abe9174c4253
--- /dev/null
+++ b/media-video/pipewire/files/gentoo-pipewire-launcher.in-r3
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+# PipeWire launcher script for XDG compliant desktops on OpenRC.
+#
+# systemd users are very _STRONGLY_ advised to use the much
+# more reliable and predictable user units instead.
+
+# 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'
+
+CONF="${XDG_CONFIG_HOME:-${HOME}/.config}/gentoo-pipewire-launcher.conf"
+if [ -f "${CONF}" ]
+then
+ . "${CONF}"
+else
+ GENTOO_PIPEWIRE_LOG='/dev/null'
+ GENTOO_PIPEWIRE_PULSE_LOG='/dev/null'
+ GENTOO_WIREPLUMBER_LOG='/dev/null'
+fi
+for L in \
+ "${GENTOO_PIPEWIRE_LOG}" \
+ "${GENTOO_PIPEWIRE_PULSE_LOG}" \
+ "${GENTOO_WIREPLUMBER_LOG}"
+do
+ if [ ! -e "${L}" ]
+ then
+ touch "${L}"
+ fi
+done
+
+restart () {
+ echo "Terminating PipeWire processes ..."
+ pkill -u "${USER}" -x pipewire\|wireplumber 1>/dev/null 2>&1
+
+ # pidwait was renamed to pwait w/ procps-4 (bug #914030)
+ if command -v pidwait > /dev/null ; then
+ pidwait -u "${USER}" -x pipewire\|wireplumber
+ elif command -v pwait > /dev/null ; then
+ pwait -u "${USER}" -x pipewire\|wireplumber
+ fi
+
+ echo "PipeWire terminated."
+}
+
+if [ "${#}" -gt 0 ]
+then
+ if [ "${1}" = 'restart' ]
+ then
+ restart
+ else
+ echo "Unrecognised argument." >&2
+ echo "Usage: gentoo-pipewire-launcher [restart]" >&2
+ exit 1
+ fi
+fi
+
+if pgrep -u "${USER}" -x pipewire\|wireplumber 1>/dev/null 2>&1
+then
+ echo "PipeWire already running, exiting." >&2
+ echo "(Use 'gentoo-pipewire-launcher restart' to restart PipeWire and WirePlumber.)" >&2
+ exit 1
+fi
+
+# The core daemon which by itself does probably nothing.
+echo "[$(@GENTOO_PORTAGE_EPREFIX@/bin/date ${DATE_FORMAT})] Starting PipeWire." 1>>"${GENTOO_PIPEWIRE_LOG}"
+@GENTOO_PORTAGE_EPREFIX@/usr/bin/pipewire 1>>"${GENTOO_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 "[$(@GENTOO_PORTAGE_EPREFIX@/bin/date ${DATE_FORMAT})] Starting PipeWire-Pulse." 1>>"${GENTOO_PIPEWIRE_PULSE_LOG}"
+@GENTOO_PORTAGE_EPREFIX@/usr/bin/pipewire -c pipewire-pulse.conf 1>>"${GENTOO_PIPEWIRE_PULSE_LOG}" 2>&1 &
+
+# Hack for bug #822498
+sleep 1
+
+# Finally a session manager is required for PipeWire to do anything.
+echo "[$(@GENTOO_PORTAGE_EPREFIX@/bin/date ${DATE_FORMAT})] Starting WirePlumber." 1>>"${GENTOO_WIREPLUMBER_LOG}"
+exec @GENTOO_PORTAGE_EPREFIX@/usr/bin/wireplumber 1>>"${GENTOO_WIREPLUMBER_LOG}" 2>&1