Pactl: switch between headphones and speakers

I used to run these commands:

        pactl set-sink-port 0 analog-output-lineout
        pactl set-sink-volume 0 69%

        pactl set-sink-port 0 analog-output-headphones
        pactl set-sink-volume 0 50%

To switch from headphones (low volume) to speakers (higher volume). This used to work, but then I had to re-install Fedora. It no longer does. :sob:

The analog-output-lineout seems to play, but no sound comes from the speakers as long as the headphones are plugged in. As soon as I unplug them, everything work.

Neither setting with gnome-control-settings not pavucontrol seem to matter: as long as the headphones are plugged in, the speakers do not work.

I ran pactl list with and without headphones and here is the diff:

diff log-headphones.log log-no-headphones.log
60,63c60
< 	Properties:[details="pactl list with headphones"]
< ```
< ```
< [/details]
---
> 	Properties:
366c363
< 		analog-output-headphones: Headphones (type: Headphones, priority: 9900, availability group: Legacy 5, available)
---
> 		analog-output-headphones: Headphones (type: Headphones, priority: 9900, availability group: Legacy 5, not available)
715c712
< 		analog-input-front-mic: Front Microphone (type: Mic, priority: 8500, availability group: Legacy 1, available)
---
> 		analog-input-front-mic: Front Microphone (type: Mic, priority: 8500, availability group: Legacy 1, not available)
1689c1686
< Client #2923
---
> Client #2924
1700c1697
< 		object.serial = "2923"
---
> 		object.serial = "2924"
1703c1700
< 		application.process.id = "216655"
---
> 		application.process.id = "216755"
1964c1961
< 		input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority: 65, available: yes)
---
> 		input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority: 65, available: no)
1968c1965
< 		analog-input-front-mic: Front Microphone (type: Mic, priority: 8500, latency offset: 0 usec, availability group: Legacy 1, available)
---
> 		analog-input-front-mic: Front Microphone (type: Mic, priority: 8500, latency offset: 0 usec, availability group: Legacy 1, not available)
1994c1991
< 		analog-output-headphones: Headphones (type: Headphones, priority: 9900, latency offset: 0 usec, availability group: Legacy 5, available)
---
> 		analog-output-headphones: Headphones (type: Headphones, priority: 9900, latency offset: 0 usec, availability group: Legacy 5, not available)

What am I doing wrong?

You might have to disable jack detection to allow both jacks to work at the same time.

1 Like

I got scared by hdajackretask’s interface. PTSD from the 1990s! :grin:

However, the thread did provide me with another (simpler?) solution:

I tried it and it works.

@jn64 Thank you so much for your help.

1 Like

I think there are also external solutions/devices that don’t require any clicking and do switching between outputs automatically, like audioswitch headphone stand.