---
title: Dual-headed X11
layout: default
created: 2008-08-11 18:10:56 +0200
updated: 2009-07-23 12:44:36 +0200
toc: false
tags:
  - know-how
  - software
  - linux
  - display
  - x11
---
per user
========

The native screen-size detection doesn't work for dual-head installations. To let X11 handle both screens as one large
display, find the section `Screen` in the `/etc/X11/xorg.conf` and add the following lines:

~~~
SubSection "Display"
    Virtual 2560 1024
EndSubSection
~~~

This is for two 1280x1024 displays side-by-side (1280+1280 = 2560). Now you can use `xrandr` to set displays.

    xrandr -q

Shows all available displays. Usually it will show the devices `VGA-0` and `LVDS`. To change the output of the external
display to be left of the internal LCD panel, use something like

    xrandr --output VGA-0 --left-of LVDS

You might also have to use *System* → *Preferences* → *Screen Resolution* to configure the location of the displays.


Fix screen order
----------------

Under *Intrepid*, it often happens to me that my screenorder is wrong after login. This is shown by a mirrored output on
the left display, but the system thinks that there's a left workspace. On rare occassions, I even have the wrong order
(i.e. if I move the mouse to the right on the right workspace, it appears on the left display's workspace.) This is
quickly fixed by switching the order around:

{% highlight bash %}
#!/bin/sh
echo Switching position of displays
xrandr --output VGA-0 --right-of LVDS
echo Switching off ext. display
xrandr --output VGA-0 --off
echo Switching back to normal
xrandr --output VGA-0 --mode 1280x1024 --rate 75 --left-of LVDS
{% endhighlight %}

After calling the script, my displays are showing the correct workspaces.


system-wide
===========

To configure dual-head system-wide (for Desktop computers), there is a great manual at [UbuntuForums](http://ph.ubuntuforums.com/showthread.php?t=826717).

1. Use `xrandr -q` to get the output device's names (for me it was `VGA-0` and `DVI-0`)
1. open the `/etc/X11/xorg.conf` in your favorite editor
1. find the section `Device` and add 2 lines so that it looks like this:  
  
        Section "Device"
            Identifier "Configured Video Device"
            Option "monitor-VGA-0" "right"
            Option "monitor-DVI-0" "left"
        EndSection
1. The device names have to be prefixed with `monitor-`. The names after that are for you to choose.
1. find the `Monitor` section and change the identifier to one of the names. (e.g. `right`)
1. add another `Monitor` section below and change the identifier to the other name. (`left`) Also add the
   line `Option "LeftOf" "right"` in between.
1. now the both monitor sections should look like this:  
  
        Section "Monitor"
            Identifier "right"
        EndSection
        
        Section "Monitor"
            Identifier "left"
            Option     "LeftOf" "right"
        EndSection
1. find the `Screen` section and add the following line to define the default display.  
  
        Monitor "right"
1. add a `SubSection "Display"` and the `Virtual` line as with the per-user configuration
1. save the file and restart X
