Default sound device changes when choosing X instead of Wayland

I got an annoying issue with my default audio device. If I use Wayland, everything works just fine. However, I can’t switch to hybrid graphics with Wayland, so I have to use X. Using X switches my my default audio device from my prefered one to the HDMI, which of course doesn’t provide any sound through my DAC. I have to manually go to advanced sound settings and switch it back.

That’s not a huge task, but it sometimes switches back to HDMI, usually when I’m gaming on my VM. Also my mouse stops working at the same time.

Any ideas what’s going on?

I do not know why x and Wayland change default sounddevice, but a workaround could be to blacklisting HDMI sound in a way. Usually Pulseaudio on top of alsa is what handles sound.

What gives: cat /proc/asound/modules ?

Then create:

/etc/modprobe.d/blacklist.conf

And add module for HDMI like so

blacklist hdmi_etc_something

Here’s what I get with the cat command:

0 snd_hda_intel
1 snd_usb_audio

It’s funny the default audio device doesn’t switch to HDMI, but Analog audio instead. Maybe because my monitor has an anolog out?

I’ll try to blacklist HDMI when I get back home.

I believe I’ve found a fix for this on another topic: Default audio device (built-in audio) keeps changing to HDMI after screen sleep

Marking this as the solution.