2021-07-21
It's nice when programs switch to being launched from systemd user units
I recently upgraded my home machine from Fedora 33 to Fedora 34. One of the changes in Fedora 34 is that the audio system switched from PulseAudio to PipeWire (the Fedora change proposal, an article on the switch). Part of this switch is that you need to run different daemons in your user session. For normal people, this is transparently handled by whichever standard desktop environment they're using. Unfortunately I use a completely custom desktop, so I have to sort this out myself (this is one way Fedora upgrades are complicated for me). Except this time I didn't need to do anything; PipeWire just worked after the switch.
One significant reason for this is that PipeWire arranges to be
started in your user session not through old mechanisms like
/etc/xdg/autostart
but through a systemd
user unit (actually
two, one for the daemon and one for the socket). Systemd user units
are independent of your desktop and get started automatically, which
means that they just work even in non-standard desktop environments
(well, so far).
(As covered in the Arch Wiki, there are some things you need to do in an X session.)
One of the things that's quietly making my life easier in my custom desktop environment is that more things are switching to being started through systemd user units instead of the various other methods. It's probably a bit more work for some of the programs involved (since they can't assume direct access to your display any more and so on), but it's handy for me, so I'm glad that they're investing in the change.
PS: It turns out that the basic PulseAudio daemon was also being
set up through systemd user units on Fedora 33. But PulseAudio
did want special setup under X, with an /etc/xdg/autostart
file that ran /usr/bin/start-pulseaudio-x11
. It's possible that
PipeWire is less integrated with the X server than PulseAudio is.
See the PulseAudio X11 modules
(also).
PPS: Apparently I now need to find a replacement for running 'amixer
-q set Master ...
' to control my volume from the keyboard. This apparently still works for some people
(also),
but not for me; for now 'pactl
' does, and it may be the more or
less official tool for doing this with PipeWire for the moment, even
though it's from PulseAudio.