When I connect my laptop to the TV via HDMI the Multi-Monitor mode is "extended" and sound profile stays on notebook speaker.

I can change Multi-Monitor mode and sound profile only temporarily. After unplug and plug again HDMI the settings are gone.

My hope is, that there's a possibility to change the default Multi-Monitor mode permanently and make a setting that the sound profile is changing to HDMI as soon as HDMI is connected.

Can someone help me?

1 Answer 1


As far as the automatic sound change goes a quick look and Ask Ubuntu came up with this answer.

I have not tested this solution but author claims it works with Ubuntu 14.04 meaning it should work with elementary OS Freya as well. All credit goes to him.

Create a file /etc/udev/rules.d/hdmi_sound.rules as root with the content:

SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/hdmi_sound_toggle"

Create a file /usr/local/bin/hdmi_sound_toggle as root with the content:

USER_NAME=`who | grep "(:0)" | cut -f 1 -d ' '`
HDMI_STATUS=`cat /sys/class/drm/card0/*HDMI*/status`

export PULSE_SERVER="unix:/run/user/"$USER_ID"/pulse/native"

if [ $HDMI_STATUS = "connected" ]
    sudo -u $USER_NAME pactl --server $PULSE_SERVER set-card-profile 0 output:hdmi-stereo+input:analog-stereo
    sudo -u $USER_NAME pactl --server $PULSE_SERVER set-card-profile 0 output:analog-stereo+input:analog-stereo

Then make it executable with chmod 0755 /usr/local/bin/hdmi_sound_toggle

I tried to make this script as generic as possible, but you still might need to change some lines, such as the HDMI_STATUS file path or the profiles used. You can see a list of profiles by running pactl list cards and looking under Profiles.

Note that the script failed for me when I removed the keyword "export" when setting PULSE_SERVER, I think pactl is looking for the env variable

Don't forget to reload your udev rules: sudo udevadm control --reload-rules

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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