how do I prevent Xorg using my Linux laptop's display panel?

I was able to achieve the desired aim with the following xorg.conf:

Section "Monitor"
        Identifier      "laptop panel"
        Option  "ignore"        "true"
EndSection
Section "Monitor"
        Identifier      "big display"
EndSection    
Section "Device"
        Identifier      "onboard"
        Option  "Monitor-LVDS1" "laptop panel"
        Option  "Monitor-DVI1" "big display"
EndSection

the critical element being Option "Ignore" "true". I might be able to simplify this further, but it works. I don't yet know what will happen when/if I use the laptop away from the external display, possibly X will exit with an error - not a perfect solution but I can move the configuration out of the way in that event.


I would suggest a slightly different approach that might be more flexible for those rare occasions you want to use the laptop as a laptop.

Depending on your display manager (probably GDM, KDM, or LightDM) you can run a script as the display manager starts up. You won't need a modified xorg.conf file at all. the location for the script is as follows(1):

  • KDM: /etc/kde/kdm/Xsetup (at the bottom)
  • SDDM: /etc/X11/xdm/Xsetup (at the bottom)
  • XDM: /etc/X11/xdm/Xsetup (at the bottom)
  • GDM: /etc/gdm/Init/Default - place the script code just above the "/sbin/initctl" line. (1)
  • LightDM: /etc/lightdm/lightdm.conf - "display-setup-script=" points to the script wherever you want it to be. Make sure the first line of the script is #!/bin/sh and it is executable.

The script can be something like this. You'll need to replace monitor names with those appropriate for your machine. I've tried to guess based on your xorg.conf above.

/usr/bin/xrandr --current | grep "DVI1 connected "
if [ $? -eq 0 ]; then
  echo "DVI found"
  sleep 1s 
  /usr/bin/xrandr --output LVDS1 --off
  /usr/bin/xrandr --output DVI1 --auto --primary
fi

This will test if your DVI monitor is connected, and if it is enable it instead of the built in display. I've got a much more complicated version of this that makes my laptop dock well at work, but still be fine for usage elsewhere. It's more complicated for me because i'm using 5 screens at work.

(1) some file location info from http://forum.xfce.org/viewtopic.php?pid=25026#p25026


slightly modified version of the previous post's xorg.conf

Section "Monitor"
   Identifier "hdmi out"
   Option "ignore" "true"
EndSection

Section "Monitor"
   Identifier "big display"
EndSection

Section "Device"
   Identifier "onboard"
   Option "Monitor-LVDS1" "hdmi out"
   Option "Monitor-VGA1" "big display"
EndSection

seems to work for intel NM10 chip. The box has vga out for the "big display"

Tags:

Linux

Gnome

Xorg