How to make Zorin OS remember last set audio output device?

Everytime I reboot or logout it reverts back to my headphones.

I know this question has been asked before:

  1. pulseaudio - 20.04 Sound Device Reverts to Headphones on Each Restart - Ask Ubuntu
  2. Zorin 16 Pro - Audio device selection not surviving reboot

But the solutions given are the change the default output device. But I don't want a default output device. I want it to remember my last set device.

1 Like

sudo gedit /etc/pulse/

Find the lines that state:

load-module module-switch-on-connect

Comment out those lines:

# .ifexists
# load-module module-switch-on-connect
# .endif

Find the line which states:
load-module module-switch-on-port-available

And comment it:
# load-module module-switch-on-port-available

Alternatively, you can forego all of the above and try changing:
load-module module-stream-restore
load-module module-stream-restore restore_device=false

Your last-used audio sink will stay set, but you'll have to manually choose which audio sink you use, rather than it auto-switching when you, for instance, connect a USB headset.

The reason it does this is because different audio sinks become available at different times as the machine boots... it should ignore all that as the machine is booting, then load the last-used or most-recently plugged-in sink after the machine is booted.

I'm betting your speakers don't come available first during boot, so PulseAudio reverts to your headphones as fallback.

I'm looking at a way to disable auto-switching during boot. If I get it working, I'll update.

cat ~/.config/pulse/*default-sink - to show default card name
pactl list sinks | grep 'Name' - to show names of all active sinks
pactl set-default-sink <Name> - to change the default sink, using the list of all active sinks as a guide

You might also try pasystray:
sudo apt install pasystray
pasystray allows setting the default PulseAudio source/sink and moving streams on the fly between sources/sinks without restarting the client applications.

Or the more recent Sound Switcher Indicator, which plays better with Gnome:

sudo add-apt-repository ppa:yktooo/ppa
sudo apt-get update
sudo apt-get install indicator-sound-switcher


Ok, what I've come up with thus far:
until [[ `/sbin/runlevel | cut -d " " -f 2` == 5 ]]; do echo "Not Ready"; sleep 5; done

-- or --

until [[ `systemctl is-system-running` = 'running' ]]; do echo "Not Ready"; sleep 5; done

We need to incorporate that or similar into /etc/pulse/, so none of the code (or perhaps, just not the auto-switching code) gets executed until the OS reaches run level 5 (ie: the desktop). By that time, all the audio sources and sinks should be ready, so it won't revert to the fallback.

Anyone know how to do that? I don't think that file's bash scripting.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.