I have a laptop with an HDMI port. While we're homeless and staying with friends I've been plugging it into their surround sound receiver with an HDMI cable. To get sound working I have to open up the sound settings jobby and switch the hardware profile from "Analogue Stereo Output" to "Digital Stereo (HDMI) Output" to have sound coming from the surround sound instead of the laptop's mincey speakers.
I have to do the reverse when I unplug it to get sound coming out of the speakers.
I'm getting a little bored of doing this. I'd like to script this. I have seen this question and its answer but pacmd list-sinks only shows one sink when the sound profile drop down shows several options.
And is there a udev event I could hook this into so it can run the script whenever the HDMI status changes?
I had the same problem but its easy to fix in kubuntu...go to system settings, screen and you will find both your internal and hdmi screen...choose your settings and in the bottom choose hdmi as your default output and save your profile at the bottom...every time you log into kde it will use your hdmi screen as default and your sound output will be auto set by phonon...
There is a tool in the ubuntu repositories, padevchooser, which claims to let you change the output on the fly. I tried this and it doesn't really work for me (trying to switch output between built-in sound card and external USB music centre). The tool only lets me select "Default" and "Other..." instead of listing my two output options.
You might, however, want to have a look at this blog post describing how to write a script to change the output device to HDMI. I don't know of a way to run this automatically, but at least it's only one click, so you can bind it to an unused button on your laptop.
udevadm monitorto see which udev events are triggered by HDMI status changes, but according to this: [spinics.net/lists/xorg/msg52939.html], not all are perhaps supported.