Hello,
I connect my laptop to various HDMI displays (home office, work, TV).
In some case, I would like the default audio output to be the HDMI display (on TV for instance). For the other displays that do not have speaker, I would like to use the laptop built-in speakers.
Mint does not seem to distinguish hdmi displays. It only retains my last configuration. If I manually chose to use my laptop speakers at my office, it will keep these settings when plugged to the TV. And vice versa.
How can I configure Mint to remember the audio output settings for each screen?
It's really a pain in the a** to switch manually each time.
Thanks for your help.
[SOLVED] Remember audio output config for different HDMI displays
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
[SOLVED] Remember audio output config for different HDMI displays
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Remember audio output config for different HDMI displays
Hi halden,
I do not possess the scripting skills necessary to accomplish what you want, but have an alternative way to do it that might be "good enough" for you.
I assume when you connect to an external display, the output is automatically switching to it. To revert to the internal audio, simply run a command like this:
To get the proper name of the sink, run
You can also tie that to a keyboard shortcut if you like then it'd be even easier to switch back to the internal audio card.
All the above assumes you have a separate audio cards for internal and HDMI audio.
I do not possess the scripting skills necessary to accomplish what you want, but have an alternative way to do it that might be "good enough" for you.
I assume when you connect to an external display, the output is automatically switching to it. To revert to the internal audio, simply run a command like this:
Code: Select all
pacmd set-default-sink alsa_output.pci-0000_00_14.2.analog-stereo
pacmd list-sinks
in the terminal and replace alsa_output.pci-0000_00_14.2.analog-stereo above as appropriate.You can also tie that to a keyboard shortcut if you like then it'd be even easier to switch back to the internal audio card.
All the above assumes you have a separate audio cards for internal and HDMI audio.
Re: Remember audio output config for different HDMI displays
Thanks for your answer MrEen.
I just realised that I use the same USB hub to connect to all the displays because my laptop does not have hdmi port (Dell XPS 13 9370). I am not familiar with hardware technicalities but I suspect that Mint only sees the hub and not the display connected to it, which would explain the observed behaviour.
I wonder if more high-end docking station such as the dell D3100 would solve the problem.
Unless I'm mistaken, this is not really the behaviour I observe. If I choose the laptop internal speakers for the audio output while connected to one hdmi display, it will save this choice when connecting to the other hdmi displays. Mint treats all the display as if there were the same.I assume when you connect to an external display, the output is automatically switching to it.
I just realised that I use the same USB hub to connect to all the displays because my laptop does not have hdmi port (Dell XPS 13 9370). I am not familiar with hardware technicalities but I suspect that Mint only sees the hub and not the display connected to it, which would explain the observed behaviour.
I wonder if more high-end docking station such as the dell D3100 would solve the problem.
Re: Remember audio output config for different HDMI displays
Ahh, when it comes to hubs being involved, my knowledge is extremely limited. I might be able to figure something out if you paste the output of this command:
The last line will have a URL pointing to your sound setup. I'm hoping I can decipher enough from that to find a decent workaround. And please be using HDMI audio when running that command. The built-in is easy enough for me to understand, but how the HDMI is working will be something new to me with it going out over the hub.
Code: Select all
curl https://gitlab.freedesktop.org/pulseaudio/pulseaudio/raw/master/src/utils/pa-info?inline=false | bash | nc termbin.com 9999
Re: Remember audio output config for different HDMI displays
Thanks again for your help.
Here is the termbin url : https://termbin.com/pxeb
Here is the termbin url : https://termbin.com/pxeb
Re: Remember audio output config for different HDMI displays
I would assume, which could be a bad idea, that all the HDMI outputs are using the same profile. If that's indeed the case, this should always switch to HDMI output:
And when you want to switch to built-in audio, use this:
You could get fancy and create a script that toggles between those two commands, and tie it into a keyboard shortcut to make it super simple to switch. There was one that was linked to yesterday that I'll try to find.
EDIT: I found it. It does it a different way, but could also be an idea worth considering: https://unix.stackexchange.com/question ... -the-shell
Code: Select all
pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:hdmi-stereo-extra1+input:analog-stereo
Code: Select all
pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:analog-stereo+input:analog-stereo
EDIT: I found it. It does it a different way, but could also be an idea worth considering: https://unix.stackexchange.com/question ... -the-shell
Re: Remember audio output config for different HDMI displays
Thanks !
For people who might have the same issue, I wrote a small script that switch the audio output, which I bound to a keyboard shortcuts (keyboard settings) :
For people who might have the same issue, I wrote a small script that switch the audio output, which I bound to a keyboard shortcuts (keyboard settings) :
Code: Select all
#!/bin/bash
current_profile=$(pacmd list-cards | grep active | sed 's/^[[:space:]]*//;s/active profile: <output://;s/>//')
if [ $current_profile = "analog-stereo" ]
then new_profile="hdmi-stereo-extra1"
else new_profile="analog-stereo"
fi
pacmd set-card-profile alsa_card.pci-0000_00_1f.3 output:$new_profile