The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Using two monitors with X.org 17 March 2008
Need more help on this topic? Click here
This article has 2 comments
Show me similar articles

I recently started building up a new box which will eventully become both a workstation and a jail server. This computer has two monitors attached and it runs pretty good.

The hardware is:

  • AMD Phenom(tm) 9600 Quad-Core Processor (2300.91-MHz K8-class CPU)
  • 4GB RAM
  • 2x500GB SATA 3.0 drives (soon to be gmirrored)
  • Two Dell 2005FPW 1680x1050 screens
  • e-GeForce 8600 GT video card

My thanks to Christian Laursen for helping me set this up. He put me onto xrandr and the Virtual keyword.

The xorg.conf

The key section in my xorg.conf file is the Screen. I have reproduced it here. Note the Virtual directive. The 3360 is 2 x 1680, which is the horizontal resolution of one of my monitors. This gives us a virtual screen twice as wide as a single screen. Which is not coincidental, given I have two monitors.

Section "Screen"
    Identifier  "Screen 1"
    Device      "e-GeForce8600GT"
    Monitor     "Dell2005FPW"
    DefaultDepth 24

    Subsection "Display"
        Depth       8
        Modes       "1680x1050" "1280x1024" "1024x768" "800x600" "640x480"
        Virtual 3360 1050
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes       "1680x1050" "1280x1024" "1024x768" "800x600" "640x480"
        Virtual 3360 1050
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "1680x1050" "1280x1024" "1024x768" "800x600" "640x480"
        ViewPort    0 0
        Virtual 3360 1050
    EndSubsection
EndSection
At this point, both screens are set up and connected to the video card, which has two DVI outputs. When you start X, you'll see the same image on both screens.
xrandr magic

Be sure to install x11/xrandr. This is a "Primitive command line interface to the RandR extension". See http://en.wikipedia.org/wiki/XRandR for more information.

cd /usr/ports/x11/xrandr
make install clean

After installing, run xrandr. I saw this:

$ xrandr
Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 1680 x 1680
VGA1 disconnected
DVI0 connected 1680x1050+0+0 434mm x 270mm
   1680x1050      59.9*+
   1280x1024      75.0     59.9
   1152x864       74.8
   1024x768       75.1     60.0
   800x600        75.0     60.3
   640x480        75.0     60.0
   720x400        70.1
VGA2 disconnected
DVI1 connected 1680x1050+0+0 434mm x 270mm
   1680x1050      59.9*+
   1280x1024      75.0     59.9
   1152x864       74.8
   1024x768       75.1     60.0
   800x600        75.0     60.3
   640x480        75.0     60.0
   720x400        70.1

Now for the magic. Issue the following command:

xrandr --output DVI1 --right-of DVI0

Now you should have one large desktop and be able to move the mouse from one monitor to the other. Very nice. :)

Keeping the two screens every time

To invoke xrandr each time you start X, add the command to ~/.xinitrc (or ~/.xsession, whichever you are using):

xrandr --output DVI1 --right-of DVI0
I added that entry just before the call to startkde.

Here is my screen shot.

screen shot.


Need more help on this topic? Click here
This article has 2 comments
Show me similar articles