Automatically switching tv layout and sound hardware when connecting HDMI
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Automatically switching tv layout and sound hardware when connecting HDMI
Howdy,
Does anyone know if there are any shortcuts to automatically enable video and audio through HDMI when I plug my laptop into my AV Receiver?
Currently in Gnome I go into system settings, displays, enable the new 2nd screen and set the resolution and apply. then I go to sound preferences and change the hardware from internal analog duplex to hdmi output.
I'm not that fussed about it all configuring by itself, but I'd really like to be able to script the config changes at least.
to do what? I can certainly fire off a bunch of commands when I plug my TV in, but what would those commands actually be? TBH I'm not even sure what controls the sound config these days. I've been "just using" fedora for so long I've paid so little attention to what's under the hood!
sorry I don't use fedora but until you get a better reply try this when you get a chance pls
1) with laptop not plugged into device....consider posting the output of your xorg.conf
then plug in to device......if xorg changes post both before and after files pls.......we can use them to create an udev rule.
2) Not sure why gnome uses for sound....do you have pulseaudio running? or oss or alsa?
Pffft! Why is it so so often the case that I can't make any progress until I ask for help then work it out myself anyway???
Code:
#!/bin/sh
if [[ $1 ]]
then
xrandr --output HDMI1 --off
pactl set-card-profile 0 output:analog-stereo+input:analog-stereo
else
xrandr --output HDMI1 --mode 1280x720 --right-of LVDS1
pactl set-card-profile 0 output:hdmi-stereo+input:analog-stereo
fi
Hurrah. job done. I don't know if it's feasible to make a udev rule for removal as my laptop seems to screw up royally if I try to look at the display layout if the TV is configured but absent. Nice enough start though. Thanks for the mind nudge.
Last edited by acid_kewpie; 09-20-2011 at 03:41 AM.
I'm having the same problem except it only happens with the audio. The video is automatic but i have to go into sound and change it manually when hooked up to hdmi. I don't want to screw anything up so if I use your code and just leave out the video settings will this work or do I have to change any of the values?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.