How To Setup Dual Monitors With XRandR


Dual monitor setup in Linux has never been easier. While methods such as the xinerama extension sometimes drive people insane, using RandR (Resize and Rotate) is quick and painless. This will allow you to use both monitors as one big screen instead of two identical ones (cloning). Follow these simple steps to get started.

Note: This HOWTO assumes that you are using the opensource drivers for your video card (ATI or Intel). Nvidia and AMD proprietary drivers come with their dual screen components.

1. Setup your xorg.conf configuration file:

Edit it as root:

(in GNOME) or

(in KDE)

2. Create a subsection under the “Screen” section with the following.

Xrandr will function without these xorg.conf lines, but it will limit the size of your desktop.

For my computer, I am using two monitors with 1440×900 resolution. If you have a different resolution, put those resolutions under “modes” and then combine the width of both for “virtual”. In other words, if you have a 1280×800 monitor, it would be “Virtual 2560 800”.

3. Save your changes, exit and restart X.

4. Now, you can setup your dual screens however you like. First find out some information about the screens. Open a terminal emulator and type:

It should tell you the name of each screen and its current resolution. On my computer, my screens are “DVI-0” and “DVI-1”.

5. To make one large desktop including both screens, run this command:

DVI-0 is on the right, and DVI-1 is on the left.

6. Create a script called “startxrandr” to run this command whenever you want.

7. Make sure to make the script executable

That is all it takes. You can play around with it and see all of xrandr’s commands by running “xrandr -help”.


There are also a few GUI applications that allow you to control xrandr.  Check with your Linux distribution.

You can set xrandr to run when your display manager or desktop environment starts. See the its documentation for startup applications.

KDE and GNOME will automatically configure two screens correctly so that maximizing a window will only fill one of the screens. Some desktop environments do not yet have support for this. You will have to test the one you use. You should have no problems with Compiz.

You can have two monitors with different resolutions, which is useful if you are using a laptop connected to a larger monitor.

In KDE, each screen will automatically be a different activity, and you can apply different widgets on each.

Some applications, especially those that rely on SDL (like many Linux games), may not honor your xrandr settings. If you are lucky, it will just clone the game on both screens. For applications like Boxee, you will need to set the environment variable before starting it: