octo's guide to multiscreening

Table of Content

  1. Why multiscreening?
  2. What you need
  3. How to set things up
    1. The overall structure
    2. My XF86Config-4 as a sample
    3. The ServerLayout section
  4. Choosing the right window manager
  5. xinerama
  6. Links for further reference

1: Why multiscreening?

When you seriously ask this question, you're propably on the wrong track. I'm not trying to make you go and buy a second monitor, but to tell you how to get it work. Anyhow, here are some reasons I could think of:

2: What you need

It's not very much you need to set up a multi screen system: basically two (or more) monitors and two (or more) graphic cards or alternatively a dual-head graphics card. I didn't do a comparsion of all available cards, but Martox cards work excellent for me, so I can recomend these. At last you need an appropriate OS. I will talk about linux in this document but any OS should do. (And NO!, windows is NOT an OS and will not work (at least not as you intended it to work. It doesn't work without a graphics card, it crashes quite often with one, so why the hell should it work with two?!). Anyhow, for linux you definitely need X11 and possibly a framebuffer for the console. I don't know of any window manager not supporting multiscreening, but you might want to take a look at "4 Choosing the right window manager" to get an idea what you can (and should) expect from the window manager. And last (but not least) you might need a bigger desk.

3: How to set things up

The software you have to install is

Amazingly short list, eh? Well, but that's all you need. Now all you need to do is set it up. The configuration file usually resides at /etc/X11/XF86Config-4, but this may vary on your system.

3.1: The overall structure

XFree86's config file is devided into "sections". At the time of this writing there are 12 sections, the important ones are:

For a (complete?) list of configuration options read the XF86Config(5x) manpage, available at xfree86.org.

3.2: My XF86Config-4 as an example

This is my very own XF86Config-4 which is meant to be a help for you. If you simply copy this configuration your X is very likely to misbehave, so edit it first! Anyhow, you can download it here.


# XFree86 4.0 configuration by Florian "octo" Forster  (2002-06-03)

# This approach uses xfs which may or may not be installed at your system..
Section "Files"
        FontPath "unix/:7100"
EndSection

Section "Module"
        Load  "dbe"             # Double-buffering
        Load  "GLcore"          # OpenGL support
        Load  "dri"             # Direct rendering infrastructure
        Load  "glx"             # OpenGL X protocol interface
        Load  "extmod"          # Misc. required extensions
        Load  "v4l"             # Video4Linux
        # Load  "pex5"          # PHIGS for X 3D environment (obsolete)
        # Load  "record"        # X event recorder
        # Load  "xie"           # X Image Extension (obsolete)

        # You only need the following two modules if you do not use xfs.
        # Load  "freetype"      # TrueType font handler
        # Load  "type1"         # Adobe Type 1 font handler
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "keyboard"
        Option      "XkbLayout" "us"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Device" "/dev/mouse"
        Option      "Protocol" "IMPS/2"
        Option      "Emulate3Buttons" "no"
        Option      "ZAxisMapping" "4 5"
EndSection

Section "Monitor"
        Identifier "LKM0B63"
        VendorName "Novita"
        ModelName  "Unknown"
        HorizSync 30 - 69
        VertRefresh 47 - 104
        Option "dpms"
EndSection

Section "Monitor"
        Identifier "Philips"
        VendorName "Philips"
        ModelName  "107E20"
        HorizSync 30 - 70
        VertRefresh 50 - 160
        Option "dpms"
EndSection

Section "Monitor"
        Identifier "SSI"
        VendorName "Seiko Instruments"
        ModelName  "CM-1440-20"
        HorizSync 31 - 40
        VertRefresh 50 - 90
EndSection

Section "Device"
        Identifier "Matrox_Mystique"
        Driver "mga"
        BusID "PCI:0:8:0"
EndSection

Section "Device"
        Identifier "Matrox_G550_0"
        Driver "mga"
        BusID "PCI:1:0:0"
        Screen 0
EndSection

Section "Device"
        Identifier "Matrox_G550_1"
        Driver "mga"
        BusID "PCI:1:0:0"
        Screen 1
EndSection

Section "Screen"
        Identifier "Screen 0"
        Device "Matrox_G550_0"
        Monitor "Philips"
        DefaultDepth 16
        Subsection "Display"
                Depth 24
                Modes "1152x864" "800x600" "640x480"
        EndSubSection
        Subsection "Display"
                Depth 16
                Modes "1152x864" "800x600" "640x480"
        EndSubSection
EndSection

Section "Screen"
        Identifier "Screen 1"
        Device "Matrox_G550_1"
        Monitor "LKM0B63"
        DefaultDepth 24
        Subsection "Display"
                Depth 24
                Modes "1024x768"
        EndSubSection
EndSection

Section "Screen"
        Identifier "Screen 2"
        Device "Matrox_Mystique"
        Monitor "SSI"
        DefaultDepth 24
        Subsection "Display"
                Depth 24
                Modes "800x600"
        EndSubSection
EndSection

Section "DRI"
        Mode 0666
EndSection

Section "ServerLayout"
        Identifier "octo configured"
        Screen "Screen 2"
        Screen "Screen 0" LeftOf "Screen 2"
        Screen "Screen 1" LeftOf "Screen 0"
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

3.3: The ServerLayout section

The ServerLayout section tells the X server in which relation to each other the screens are located. Possible keywords for relationships are "Absolute", "RightOf", "LeftOf", "Above", "Below" and "Relative". The very most setups will be okay with using "LeftOf" (or "RightOf", if you wish) only, but more complex setups (with probably more than just two screens) may need the other options..

4: Choosing the right window manager

Choosing a window manager is mostly a question of style and comfort I guess.. My very favorite window manager is larswm, a very minimalistic one. Another window manager I like a lot is golem, also kinda minimalistic but enhanced by a bunch of plugins. A long list of the most common and some very exotic window managers can be found at xwinman.org, a site offering tonns of information on X, too. (Almost) All window managers support multimonitor-usage, since the window manager itself doesn't have to know very much about this case. In general you can think of one window manager being started per screen, which isn't exactly what is happening, but close. If you think of your screens as being run by different instances of the window manager it's easier to understand why you can't move windows across the screens, for instance. When seeing this scenario from the window manager's perspective you see, that each window manager handles exactly one screen, which is why basically every window manager supports this mode. However, this would be too easy, so there is an extra mode, called xinerama (described in detail in section 5). In this mode you can move windows over screen borders onto another screen, but there needs to be done some extra work in the window manager since the screen doesn't neccessarilly need to be rectangular anymore.. And window manager certainly differ in support for this mode. golem has such support, larswm doesn't.. (Actually, I've written a Xinerama-patch for larswm, but it's not in the main distribution) So if you want to use xinerama you should think about this for a second. By the way: there are window managers which support two or more physical screens and moving windows between them, but with xinerama being available I wouldn't build onto such a "homebrew" solution..

5: xinerama

xinerama is an extension to XFree86 (versions 4.0 and above) which combines the physical screens to one big virtual screen. With this process being absolutely transparent to the window manager it's a whole lot easier to realize a reasonable support for multiscreening. Although you don't have to rewrite your window manager if you want to add support for xinerama there are still some things you should take care of. Windows shouldn't pop up between screens, e.g. Windowmanagers doing this include Window Maker, golem and Sawfish, to name just a few.

If you want to use xinerama you have to start your X-server in an appropriate way. This may mean that you have to edit your startx script.. Running your X-server from the console you can load xinerama like this:

octo@leeloo:~ $ /usr/X11R6/bin/X +xinerama

6: Links for further reference


© 2002 by Florian Forster <octopus at verplant dot org>
Last update: 2004-05-18 15:28 (GMT+1)
This site validiates as XHTML 1.1
This site uses valid CSS2
Please give credit when quoting this site