How to detect external monitor connection on laptop
Linux - MobileThis forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Sailfish OS, Replicant, Ubuntu Touch, webOS, and other similar projects and products.
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.
How to detect external monitor connection on laptop
Hi all,
I have a Lenovo T61p w/ NVIDIA FX570M GPU running Slack 12.2.
I sometimes have an external monitor connected, and like having it set up as a separate Screen in X (i.e. laptop DFP as :0.0 and external as :0.1).
I can do this no problem when the monitor is connected. Only trouble is that if the external monitor is not connected, X won't start unless I either change the default ServerLayout or pass a command-line option.
I'd like to have it automagically figure out whether or not to try and use the second screen.
As far as I can tell, X will not sequentially try ServerLayouts in the xorg.conf file until one works (which would be a really nice feature, IMHO).
So, is there a command that I can have startx (or similar) run to determine if anything is connected and then call X with the appropriate ServerLayout?
I've waded through the /sys and /proc directories, checked every logfile I can think of, and can't find anything that reports the connection status.
I don't think that's going to work as I need a way to detect the monitor connection *before* X is started. If X isn't running xrandr returns "Can't open display"
Connect the monitor, flat panel, or projector to the laptop's 15-pin video connection on the back of the computer as shown to the right. Once connected, your laptop may automatically switch to the new external display or you may be required to press a sequence of keys in order to switch from the laptop to the external display.i hope this helps
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.