My speakers are plugged via optical output. Each time my screen wake up from sleep, pusleaudio automatically switch to HDMI audio where nothing is plugged.

How can I prevent that ?


Let me know if this doesn't work for you and I'll delete my answer. I don't have your speaker system but this should work.

Disable automatic device switching

When signal is lost to during sleep, Pulse Audio is automatically configured to activate the default source (your HDMI). Upon resume the sound device is still on HDMI. To override this setting, tell Pulse Audio to never switch sound devices automatically:

  • edit the file /etc/pulse/default.pa
  • find the line load-module module-switch-on-port-available
  • insert a # at the beginning of the line to disable automatic port switching
  • save file and exit editor
  • type pulseaudio -k to reload configuration
  • Works like a charm, thanks. Just for the note I restarted pulse without rebooting using 'pulseaudio -k' . – Vincent Tschanz Aug 2 '18 at 19:31
  • @VincentTschanz Thank you for your comment. I've updated the answer with it. – WinEunuuchs2Unix Nov 4 '18 at 13:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.