Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a laptop usually (!) connected to an external monitor. Now I want to configure (if possible without any scripts and/or xrandr) xorg such that

  • If the external monitor is connected AND the laptop lid open -> both displays extended
  • If the external monitor is connected AND laptop closed -> only external
  • If the external monitor is not connected -> laptop monitor.

Right now, my /etc/X11/xorg.conf.d/10-monitor.conf looks like the one proposed in the Arch wiki here. Now, I have the following issues:

  • after boot when the laptop lid is closed, still both monitors are active (even though I can't move the mouse out of the external one's desktop)
  • when I open the lid, the external monitor becomes black while I can move the mouse out of the laptops screen. Switching off and on the external monitor with xrandr makes it work again.
  • When I open the laptop, so that the external monitor becomes black and close the laptop again, X crashes and I have to reboot the laptop. (no keyboard combination works anymore and I see nothing but a non-moving mouse arrow on the external screen)

It is quite annoying that the monitors don't behave properly automatically. It's an intel chip (onboard) and the external monitor is connected via DisplayPort.

I don't really know what to look for in which logfile, so maybe you can help me out.

share|improve this question

When I've done things like that in the past, the way I accomplished it was by having multiple /etc/X11/xorg.conf files. Then in /etc/rc.local (or equiv), detect your conditions upon starting up and copy the right file into place before the X server is started.

In the end, though, I no longer go this route. It's far easier to do the dynamic xrandr/gui-config hacks these days because they let you do it dynamically not just at boot time and even as you plug and unplug the monitors live. There isn't any xorg.conf settings that refer to dynamically changing connections, for instance.

[oh, and I generally recommend you don't run your laptop with the lid closed. It doesn't cool as well and in the long run you'll likely run into heat-damage issues]

share|improve this answer
Thanks for the answer. I tried using an acpi/udev event script, but that failed sometimes and left me no option but rebooting the computer. As for the lid closed: I am constantly checking the temperature of the laptop (using conky on the desktop) and I am not that worried about heat damage... – janoliver Jun 2 '11 at 14:10
Glad to hear you're checking it! I know people that have fried laptops from running with the lid closed. [if the CPU isn't running full out, it'll help of course]. – Wes Hardaker Jun 2 '11 at 16:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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