#:via: hdtw-lib:config-util-pmb/pulseaudio/
#:web: https://gist.github.com/mk-pmb/2296fc95463d332b7c4d0c500be6864d
On Ubuntu focal, I usually use my sound card in one of three modes: "Stereo Output", "Stereo Duplex", or "Off". (The latter to not surprise anyone in case my Bluetooth headphones disconnect unexpectedly.)
I want to be able to switch between these modes quickly in pavucontrol
.
However, between the Stereo options and the "off" option, there's a gazillion of HDMI entries wasting my attention, time and effort.
It took a while until I figured out there's a trick for keyboard control: Press "up, up, space" to switch to "Off", and "down, down, space" to switch to "Stereo Output". Still, this is not a good solution, because first I have to activate the profile selection dropdown, which I usually do by clicking it with my cursor. How nice would it be if I could just extend that click to a drag, instead of enduring an input modality switch, then have to locate two different keys, and press them the right amount of times. Not really a complicated task, but annoying enough to take my attention away from what I was originally doing.
I tried blacklisting the kernel modules snd_hda_codec_hdmi
but it doesn't
keep snd_hda_intel
from loading them.
So I sabotaged it by also adding a bogus install instruction:
# /etc/modprobe.d/blacklist-hdmi-audio.conf
blacklist snd_hda_codec_hdmi
install snd_hda_codec_hdmi /bin/true
That worked most of the way, with only two HDMI profiles surviving. Unfortunately, it also made all the analog stereo options fully mute.
(I also tried banning snd_hda_codec_realtek
to save a bit more RAM
while I was there anyway, but it doesn't make any difference on what
audio profiles will be available.)
At last, I found the place where I could disable individual profiles. Since future Ubuntu versions will replace PulseAudio with PipeWire soon, I won't waste effort for making this clean and pluggable, and instead write just a hotfix script for now.