From ArchWiki
Revision as of 22:32, 31 August 2012 by Blacktav (talk | contribs)
Jump to: navigation, search

Extreme Multihead

Configuring Multiple Monitors

  • Experiment to find best setup (xrandr)
  • Make the setup default (xorg.conf.d)

Accessing Remote Systems from a Single Desktops

  • Simple remote access (rdc)
  • Complex remote access (Xdmc)
  • Keyboard & Mouse Sharing (Synergy)
  • Complete Integration (Xdmx)

Several monitors can be attached to a single computer system. Many years ago this was only possible by installing two or more video cards in a computer. Then some high-end video cards began appearing with outputs for two monitors. Nowadays, most laptops come with a main display and a socket for an external monitor while the integrated video cards on desktop systems provide VGA + DVI + HDMI outputs as standard. If you plug in multiple monitors to whatever video sockets you have available, they will more often than not "just work" - offering two or more versions of the same display. In some cases this is exactly what is required; allowing the same desktop to be viewed from different directions.

It is also possible to have these multiple monitors work together as an extended single desktop. It is even possible to join the displays from several computers - each with single or multiple monitors - into one very large extended desktop.

This document describes how to go configure such a system.

Experimenting with Multiple Monitors

The easiest way to begin experimenting with multiple monitors is start with a system which has a working X setup supporting a single monitor. If you already have the additional equipment installed

  • a video card with multiple video outputs or multiple vide cards
  • monitors plugged into each of the video outputs

When everything is on you should see the same output on each monitor. The desktop is "cloned" on to the secondary monitors. If all the monitors are not exactly the same shape or support different resolutions you may only see portions of the main desktop display.

The best tool to experiment with configuring your monitors to display as you want is xrandr. This may already installed as part of your Xorg installation from either the xorg or xorg-apps packages.

Use xrandr to experiment with different configurations until you arrive at settings you want to make permanent. The dualhead and xrandr pages, the man page and various locations on the web provide more information on using the tool.

For example, the following command configures my dual monitor setup:

xrandr --output VGA-1 --rotate left --output VGA-1 --pos 0x0 --output DVI-0 --rotate left  --output DVI-0 --pos 1080x0
  1. I have two monitor devices with the logical names VGA-1 and ki>DVI-0. These names can be determined using the command xrandr -q or even searching through the logfile /var/log/Xorg.0.log
  2. both monitors are identical each with a resolution of 1920x1080
  3. VGA-1 is rotated 90 counter-clockwise from landscape to portrait --output VGA-1 --rotate left
  4. VGA-1 is the main display --output VGA-1 --pos 0x0
  5. DVI-0 is also rotated --output DVI-0 --rotate left
  6. DVI-0 sits immediately to the right of VGA-1 --output DVI-0 --pos 1080x0

If you have not done so already, create a simple batch script containing your desired xrandr command. Save it somewhere useful; /usr/local/bin perhaps. Your system can then be configured to call this script as you login to your account as your window manager starts. There are different locations for saving initialisation commands and indeed some Settings tools can add these commands in place for you.






If none of the above options are available to you or you need a generic solution that will apply across all window managers and/or users; add the command to either to individual or system xinitrc scripts:

  • system-wide initialisation file is /etc/X11/xinit/xinitrc; add a line after the window manager has been started but before any applications are called
    Tip: this will only work if X is started manually, not from a display manager such as kdm, gdm, slim or whatever
  • a user's personal initialisation file is ~/.xinitrc
    Tip: this will be called as a user logins in from kdm, gdm, slim or whatever; some window managers may also call a similar command if it has been included in a startup file for the window manager; if you see unexpected results, check that xrandr is not being called several times with different options
    Execution of the command is usually quite noticeable as the monitors change from the basic cloned, landscape display to the independent portrait mode.
Note: if your monitor cannot be physically rotated (sometimes referred to as ""pivot"") on its stand, it is unlikely they will support this feature even if you can physically rotate them using a vesa mounting device; check the specification of the monitor. For example, Iiyama E-series monitors cannot pivot but their almost identical B-series can

Make Settings the Default

Now you have your regular desktop spanning multiple monitors, it would be better if

  • the irritating flicker as the monitors change did not happen as you login
  • the login manager was also set to span multiple monitors; this is especially irritating if your monitors are rotated, like mine, so you have to turn your head 90 as you login

All that has to be done is to create an Xorg configuration file that serves the same purpose as the xrandr command; easy now we know what the configuration should be.

We need to create two files:

  • 05-device.conf to specify how the monitor configuration can be found for the video device
  • 10-monitor to specify the actual configuration of the monitors

These configuration files, and others you may need to manage your keyboard, mouse and other devices have a multitude of options available described in Multihead and Xorg documentation; the examples below are offered to illustrate a particular solution.

Note: since Xorg moved away from a monolithic configuration file that required every option to be spelled out to the lighter multiple configuration files only over-riding a default configuration, you only need to be concerned with specifying the exact changes you want; do not simply copy from these examples


This is used to reference the individual monitor configurations by naming the devices. This configuration files should be loaded before the monitor file and so has a lower number ""05""

Section "Device"
    Identifier "radeon"
    Driver "ati"
    Option "monitor-VGA-1" "VGA-1"
    Option "monitor-DVI-0" "DVI-0"

The Identifier should match the actual video device; check /var/log/Xorg.0.log to confirm this. Similarly, Driver corresponds to the driver. Then we reference the two monitors by name pointing to relevant sections in the 10-monitor.conf file

  • monitor-VGA-1 specifies the name that Xorg will detect the monitors as; the same names the xrandr -q reported to us; the name is prefixed with """monitor-"""
  • VGA-1 specifies the identifer we will use to refer to this monitor

Essentially we are specifying a relationship between the actual device and its configuration.


This file then specifies how we want the monitors to be configured. The filename is not important other than ensuring to is loaded after the {{ic|device} file. The important elements are the Section name and its Identifier:

Section "Monitor"
    Identifier "VGA-1"
    Option "Rotate" "Left"

Section "Monitor"
    Identifier "DVI-0"
    Option "Rotate" "Left"
    Option "RightOf " "VGA-1"
  • Option "Rotate" "Left" rotates each monitor counter-clockwise 90
  • Option "RightOf" VGA-1 places the monitor identified as DVI-0 to the right of the monitor whose Identifier is VGA-1. Other possibilities include "LeftOf" "Above" and "Below"

With these configuration files in place and all references to xrandr removes, the display manager can be restarted and

  1. the display manager should start with all monitors correctly placed and oriented
  2. user login will no longer flash as xrandr executes