Audio device selection between front panel and HDMI

Hello,

I have a Fedora 30 installation and my question is about how to make Fedora change the default audio device to the headset when I connect it and to the HDMI output in the Video Card if the headset is not connected.

My setup is:

  • Gigabyte GA-990FX-Gaming motherboard with integrated sound card, I use the front panel audio connector for the headphones.
  • AMD Radeon RX580, I use the HDMI port for audio output when no headphones are connected.

The problem is that when I disconnect the headphones the audio output changes to S/PDIF (nothing connected) and I would like it to change automatically to HDMI.

Thanks.