170 kx #!/bin/bash
170 kx # Copyright 2022 Patrick J. Volkerding, Sebeka, Minnesota, USA
170 kx # All rights reserved.
170 kx #
170 kx # Redistribution and use of this script, with or without modification, is
170 kx # permitted provided that the following conditions are met:
170 kx #
170 kx # 1. Redistributions of this script must retain the above copyright
170 kx # notice, this list of conditions and the following disclaimer.
170 kx #
170 kx # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
170 kx # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
170 kx # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
170 kx # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
170 kx # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
170 kx # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
170 kx # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
170 kx # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
170 kx # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
170 kx # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
170 kx
170 kx # This script will attempt to enable pipewire as the default audio server.
170 kx
170 kx # Disable this, as it is almost certainly left over from when pipewire
170 kx # used to store its config file in this location:
170 kx if [ -f /etc/pipewire/pipewire.conf ]; then
170 kx for file in /etc/pipewire/*.conf ; do
170 kx mv ${file} ${file}.obsolete
170 kx done
170 kx fi
170 kx
170 kx # Rename the XDG autostart files:
170 kx for file in /etc/xdg/autostart/pipewire-media-session.desktop.sample /etc/xdg/autostart/pipewire-pulse.desktop.sample /etc/xdg/autostart/pipewire.desktop.sample ; do
170 kx if [ -r $file ]; then
170 kx mv $file /etc/xdg/autostart/$(basename $file .sample)
170 kx fi
170 kx done
170 kx
170 kx # Disable pulseaudio.desktop:
170 kx if ! grep -q "^Hidden=true$" /etc/xdg/autostart/pulseaudio.desktop ; then
170 kx echo "Hidden=true" >> /etc/xdg/autostart/pulseaudio.desktop
170 kx fi
170 kx
170 kx # Edit /etc/pulse/client.conf to disable autospawn:
170 kx sed -i "s/autospawn = yes/autospawn = no/g" /etc/pulse/client.conf
170 kx sed -i "s/allow-autospawn-for-root = yes/allow-autospawn-for-root = no/g" /etc/pulse/client.conf
170 kx
170 kx echo "PipeWire enabled as system multimedia server."