PipeWire/gentoo-pipewire-launcher
Those not willing or able to use the OpenRC/systemd user services for PipeWire and WirePlumber can instead use gentoo-pipewire-launcher.
PipeWire must be started before anything that might try to connect to any sound input or output, such as a volume monitoring applet.
Prerequisites
- XDG_RUNTIME_DIR
This variable is usually set automatically by systemd-logind or elogind. seatd on the other hand does need some manual steps. Users only need to set it manually if not using a session/seat manager. Those systems like the ones using seatd or those that don't use any of these seat management daemons will need to set XDG_RUNTIME_DIR manually, e.g. in ~/.bash_profile, ~/.zprofile, etc.
# Ensure XDG_RUNTIME_DIR is set
if test -z "$XDG_RUNTIME_DIR"; then
export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX)
fi
- DBUS_SESSION_BUS_ADDRESS
This variable is usually set automatically by desktop environments such as GNOME or KDE. Note that a D-Bus session bus is not what is typically being provided by the system D-Bus service, dbus, which is instead providing a system bus for things like hardware events, etc.
For further information, refer to this section of the "D-Bus" page.
gentoo-pipewire-launcher
gentoo-pipewire-launcher is a convenience script for systems not running systemd, e.g. OpenRC systems. It will only be installed if the systemd USE flag is not enabled.
As documented in the gentoo-pipewire-launcher(1) man page, the gentoo-pipewire-launcher script starts:
- a PipeWire server;
- a WirePlumber session manager, required to make use of PipeWire servers;
- a pipewire-pulse PipeWire server, required for PulseAudio compatibility.
Before doing so, the script terminates any existing PipeWire or WirePlumber instances. For further details, refer to the comments in the script.
gentoo-pipewire-launcher should be started in an environment which has the DBUS_SESSION_BUS_ADDRESS environment variable set appropriately, i.e. within the context of the program started by dbus-launch or dbus-run-session.
gentoo-pipewire-launcher supports logging, via ${XDG_CONFIG_HOME}/gentoo-pipewire-launcher.conf. The variables GENTOO_PIPEWIRE_LOG, GENTOO_PIPEWIRE_PULSE_LOG, and GENTOO_WIREPLUMBER_LOG can be used to specify the absolute path of a file to which logs should be written. If these variables are not set, log output will go to /dev/null.
gentoo-pipewire-launcher sources the gentoo-pipewire-launcher.conf file, such that the conf file can be used to add variables (e.g. PIPEWIRE_DEBUG=4) to the environment of the PipeWire and WirePlumber processes it starts.
GUI environments
Gentoo's PipeWire package installs the /etc/xdg/autostart/pipewire.desktop autostart file. However, not all GUI environments make use of autostart files: Plasma, GNOME, XFCE and Cinnamon do, but various window managers (such as Fluxbox) do not. Environments which make use of autostart files must not start PipeWire from some other location (e.g. the configuration file for that environment).
If XDG autostart is not being used, a call to gentoo-pipewire-launcher needs to be added to whichever file is used for starting programs at window manager startup, e.g. for i3:
~/.config/i3/configexec gentoo-pipewire-launcher &
For Hyprland, edit ~/.config/hypr/hyprland.lua to add:
~/.config/hypr/hyprland.luahl.on("hyprland.start", function() hl.exec_cmd("gentoo-pipewire-launcher") end)
For Sway, edit ~/.config/sway/config to add:
~/.config/sway/configexec gentoo-pipewire-launcher restart &
gentoo-pipewire-launcher's
restart option will shut down any running instances of PipeWire and start a new one; this means that any app using sound will stutter. It's okay to use restart here as long as the command is run with Sway's exec command and not the exec_always command. exec prevents sound stuttering when reloading Sway. restart prevents PipeWire failing to start after Sway exits and runs again.For dwm, edit ~/.dwm/dwmrc to add:
~/.dwm/dwmrcgentoo-pipewire-launcher &
For Wayfire, edit ~/.config/wayfire.ini to add:
~/.config/wayfire.ini[autostart]
pipewire = gentoo-pipewire-launcher
Restarting PipeWire and WirePlumber
To restart PipeWire and WirePlumber under OpenRC, e.g. to pick up configuration changes, run gentoo-pipewire-launcher with the restart argument to have it first shut down the existing instances from within the relevant D-Bus session:
user $nohup gentoo-pipewire-launcher restart &
Using nohup allows the terminal to be closed without terminating gentoo-pipewire-launcher. Where output is directed might depend on the implementation of nohup; depending on the shell, nohup might be a builtin or an external command (e.g. nohup(1)), so check the shell's documentation.
Due to a WirePlumber bug, nohup may not work, so an alternative might be required. For example, in Bash, omit nohup, then run disown immediately afterwards:
user $gentoo-pipewire-launcher restart &
user $disown