You are not logged in.

#1 2009-11-21 15:51:26

davvil
Member
Registered: 2008-05-06
Posts: 165

Automatically detecting an external monitor

I recently got an external monitor (with a nice 2048x1152 resolution smile) to use it together with my laptop in a dual-head configuration. I can configure it with xrandr and everything works fine. What I would like now is that X automatically detects if the monitor is connected and adapts the resolution accordingly. The keyword here is dynamically, I do not want to hardcode it into xorg.conf, as I also use the laptop on the road.

This looks quite good http://www.thinkwiki.org/wiki/Xorg_Rand … t_on_login, but arch doesn't seem to have the /etc/X11/Xsession.d/ directory. The most similar directory I found is /etc/X11/xinit/xinitrc.d, but it doesn't seem to work (I put an echo command redirected to a file in the script to see if it was at least trying to do something, but no). Any idea where the script should be put?

Offline

#2 2009-11-21 16:09:36

MadTux
Member
Registered: 2009-09-20
Posts: 553

Re: Automatically detecting an external monitor

Offline

#3 2009-11-21 16:30:46

davvil
Member
Registered: 2008-05-06
Posts: 165

Re: Automatically detecting an external monitor

This is more or less what I am doing, starting it manually. I could put it into .xinitrc, but I would prefer to have it working globally and automatically for all (well, the two wink) users of the laptop. And the links in the RandR1.2 page all discuss either manually selecting the output of hardcoding it into xorg.conf.

Offline

#4 2009-11-22 02:06:34

Wittfella
Member
From: Australia
Registered: 2008-05-27
Posts: 462

Re: Automatically detecting an external monitor

I don't use both screens at the same time, only one or the other depending if the external is plugged in or not but this might help you get started.  I put this in my .xinitrc:

xrandr | grep VGA | grep " connected "
if [ $? -eq 0 ]; then
    xrandr --output LVDS --off
    xrandr --output VGA --auto
fi

Offline

Board footer

Powered by FluxBB