HDMI loses default when screen sleeps

I have a PC which previously had KDE and now has XFCE.
Everything is working well except I listen via the HDMI of the screen and when the screen goes to sleep the system reverts to built-in audio.
I can change it back but it is annoying. I am tempted to stop the display going to sleep but maybe someone can help?

System:
  Kernel: 5.11.4-arch1-1 x86_64 bits: 64 compiler: gcc v: 10.2.1 
  parameters: BOOT_IMAGE=/boot/vmlinuz-linux 
  root=UUID=da7b12a4-11a6-4908-a3a4-a2d85deddd58 rw quiet 
  resume=UUID=41a6a83a-6dba-4316-a745-d453b5ab8261 loglevel=3 nowatchdog 
  Desktop: Xfce 4.16.0 tk: Gtk 3.24.24 info: xfce4-panel wm: xfwm4 
  dm: LightDM 1.30.0 Distro: EndeavourOS base: Arch Linux 
Machine:
  Type: Desktop Mobo: Gigabyte model: GA-78LMT-USB3 R2 v: sex serial: <filter> 
  BIOS: Award v: F1 date: 11/08/2017 
CPU:
  Info: 8-Core model: AMD FX-8350 bits: 64 type: MCP arch: Bulldozer 
  family: 15 (21) model-id: 2 stepping: N/A microcode: 6000852 L2 cache: 2 MiB 
  flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm 
  bogomips: 64453 
  Speed: 1524 MHz min/max: 1400/4000 MHz boost: enabled Core speeds (MHz): 
  1: 1524 2: 1407 3: 1409 4: 1399 5: 1408 6: 1409 7: 1409 8: 1416 
  Vulnerabilities: Type: itlb_multihit status: Not affected 
  Type: l1tf status: Not affected 
  Type: mds status: Not affected 
  Type: meltdown status: Not affected 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, STIBP: 
  disabled, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: NVIDIA GP106 [GeForce GTX 1060 6GB] vendor: Gigabyte 
  driver: nouveau v: kernel bus ID: 01:00.0 chip ID: 10de:1c03 class ID: 0300 
  Display: x11 server: X.org 1.20.10 driver: loaded: modesetting 
  unloaded: fbdev,vesa alternate: nouveau,nv resolution: <missing: xdpyinfo> 
  Message: Unable to show advanced data. Required tool glxinfo missing. 
Audio:
  Device-1: AMD SBx00 Azalia vendor: Gigabyte driver: snd_hda_intel v: kernel 
  bus ID: 00:14.2 chip ID: 1002:4383 class ID: 0403 
  Device-2: NVIDIA GP106 High Definition Audio vendor: Gigabyte 
  driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:10f1 
  class ID: 0403 
  Sound Server: ALSA v: k5.11.4-arch1-1 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: Gigabyte driver: r8168 v: 8.048.03-NAPI modules: r8169 port: ce00 
  bus ID: 03:00.0 chip ID: 10ec:8168 class ID: 0200 
  IF: enp3s0 state: up speed: 100 Mbps duplex: full mac: <filter> 
Drives:
  Local Storage: total: 2.94 TiB used: 113.58 GiB (3.8%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/sda maj-min: 8:0 vendor: TeamGroup model: T253LE240G 
  size: 223.57 GiB block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: 61.2 
  ID-2: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 830 Series 
  size: 476.94 GiB block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: 3B1Q 
  ID-3: /dev/sdc maj-min: 8:32 vendor: Toshiba model: DT01ACA200 
  size: 1.82 TiB block size: physical: 4096 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: ABB0 
  ID-4: /dev/sdd maj-min: 8:48 vendor: SanDisk model: SSD PLUS 480GB 
  size: 447.13 GiB block size: physical: 512 B logical: 512 B speed: 3.0 Gb/s 
  serial: <filter> rev: 04RL 
Partition:
  ID-1: / raw size: 109.76 GiB size: 107.48 GiB (97.92%) used: 9.13 GiB (8.5%) 
  fs: ext4 dev: /dev/sdd1 maj-min: 8:49 
  ID-2: /home raw size: 335.37 GiB size: 329.11 GiB (98.13%) 
  used: 69.98 GiB (21.3%) fs: ext4 dev: /dev/sdd5 maj-min: 8:53 
Swap:
  Kernel: swappiness: 60 (default) cache pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 2 GiB used: 2 MiB (0.1%) priority: -2 
  dev: /dev/sdd2 maj-min: 8:50 
Sensors:
  System Temperatures: cpu: 21.9 C mobo: N/A gpu: nouveau temp: 50.0 C 
  Fan Speeds (RPM): N/A gpu: nouveau fan: 0 
Info:
  Processes: 275 Uptime: 4h 50m wakeups: 0 Memory: 15.61 GiB 
  used: 2.2 GiB (14.1%) Init: systemd v: 247 Compilers: gcc: 10.2.0 Packages: 
  pacman: 967 lib: 264 Shell: Bash v: 5.1.4 running in: xfce4-terminal 
  inxi: 3.3.00 

I read this this but it seems to have stopped working after an update.

I am going to assume pulse audio is there - and if you run pavucontrol, on the FAR right is the Configuration tab, and if you turn OFF the alternative, HDMI audio should be undisturbed. Works for me, anyway - I need the HDMI audio because it switched with my KVM :grin:

Yes, it works until the screen goes to sleep and then I have to switch audio outputs and tick the box again. It is not that it doesn’t work, it is that it doesn’t stay when the monitor goes off.

Beyond my knowledge how THAT would happen then… must be somewhere you can tell it wake up again. On a desktop here, so no experience. I expect someone will be along :grin:

Thank you, this is also a desktop so I could disable the sleep.

Edit: for now I have disabled sleep. :slight_smile:

I guess I have too - just the display snores… I tend to have stuff happening in the background, so I don’t suspend.

I had the the opposite problem. I didn’t want the audio to switch to HDMI automatically. I fixed this by editing the default.pa file. You need to edit it so that the HDMI audio is switched on or loaded when the device becomes available.

Also worth setting the default audio devices. Here’s mine for example:

### Make some devices default
set-default-sink output alsa_output.pci-0000_00_1f.3.iec958-stereo
set-default-source input alsa_output.pci-0000_00_1f.3.iec958-stereo.monitor
set-card-profile alsa_card.pci-0000_00_1f.3 output:iec958-stereo

Edit: that said… I’m just a noob, so don’t take my word for it. I had to figure this out mostly by myself and I don’t remember how I got to the conclusion anymore. :smiley:

Thanks I will take a look, that is something I have not even thought of, I assumed it would be a user configuration not a system one. :+1: