Resetting an out-of-range resolution

If you set a resolution inappropriate for your monitor in the Screen Resolution GUI tool, you can reset it from a terminal by running

Dynamically testing different resolutions

You can either use the Screen Resolution GUI tool to experiment with different resolutions, or the more powerful xrandr command-line tool. Without parameters, xrandr shows you the names of different outputs available on your system (LVDS, VGA-0, etc.) and resolutions available on each:

You can direct xrandr to set a different resolution like this:

The refresh rate may also be changed, either at the same time or independently:

Note that changes you make using xrandr only last through the current session. xrandr has a lot more capabilities - see man xrandr for details.

Panning viewport

If you want to have a panning viewport, i.e., a virtual screen that's bigger than your physical screen that moves when you move the mouse to the edge ("zoomed in" view) specify the desired physical resolution with --mode and the virtual screen size with --fb and panning area (typically same as virtual screen size) with --panning.

For example,

How to setup a dual monitor


This article above will give you some important background information. I will summarize the points that I think are important and add a few points. It makes life easier if you pop open a terminal and type to open your gui monitor program:

Next uncheck same image in all Monitors. If your watch a lot of movies it is important to set your Monitors to your lower resolution. For example, if they are both 1440 x 900 monitors, make sure it is set to that resolution. If the monitors are different resolutions, you will need it to the resolution of the smaller monitor. So, for example, if one monitor is 1440 x 900 and the other is full HD resolution, you will have to set it at 1440×900. The reason for this is your video will be a black screen when trying to watch a movie so this is very important. Click APPLY. Then you will get a warning and you need to keep your new configuration. You will need to restart your session for this to take effect sometimes. There are 2 simple ways to do this. The first is to log out then log back in, and the second is to hit ctrl+alt+backspace. The second method restarts your x session so make you save your work.

This guide is targeted for people who want to use extended desktop mode on two outputs. Clone mode should work out-of-box with a normal configuration.

With RandR 1.2, you can setup dual head and add/remove monitor dynamically (i.e. on-the-fly, without restarting X).

Output port names

Intel driver - UMS

The SDVO and DVO TV outputs are not supported by the driver at this time.

Intel driver - KMS

radeon driver

Four methods to setup

  1. By session with .xprofile.
  2. Dynamically by using xrandr tool
  3. Statically by setting in xorg.conf.
  4. Xrandr Graphical Front End GUI.

xrandr tool (an app component in Xorg) is a command line interface to RandR extension, and can be used to set outputs for a screen dynamically, without any specific setting in xorg.conf. You can refer the xrandr manual for details.

By Session with .xprofile

Use your favorite editor to create ~/.xprofile containing something like:

Now that command will be run every time your start your Xsession. You can force it to run by logging out and logging back in or by executing ~/.xprofile from your terminal.

Here is an example of my ~/.xprofile. The # are for comments just like you do with shell scripts. The purpose of my setup is sometime have laptop on the left and other times I have my laptop on the right. This makes very simple and easy to change which side you want each monitor to be on. I just added the information on how to set your primary monitor.

Some people think it is a disadvantage that this only works for one user, other people think this is an advantage. If you want to be able to use this just copy it over to your profile folder.

Important Note: If you just blindly copy some commands from a website, you may see an error message:

This may be due to some CMS' way of modifying content: xrandr expects the letter x and not the multiplication cross × between horizontal and vertical resolution.

Incorrect example:

Corrected example

Dynamic setup with xrandr

Xrandr can be used to change outputs' mode, rotation direction, position, etc. In this guide, we only introduce options related with dual head setting.

You can see the outputs' status with option '-q'. Below is an example:

In the above example, two outputs (VGA1 and LVDS1) are connected, the resolution of both is 1024x768@60, output VGA's viewport is at (1024, 0) and output LVDS's viewport is at (0, 0), i.e. LVDS1 is located at left of VGA. The size of occupied area by both outputs is 2048x768. The virtual screen size (maximum framebuffer) is 4096 x 4096 which is statically set in xorg.conf (see next section). You can decrease the maximum with '--fb' option but can not increase it. You need make sure your screen size fall into the maximum framebuffer, otherwise you should increase the value in xorg.conf.

There are five xrandr options that can be used to set Dual Monitor:

The last four will set the output's relative position to another output, for example:

Option '-pos' is more flexible which can place output to anywhere, for example:

statically setup in xorg.conf

RandR1.2 configuration in xorg.conf is based on per monitor. So you need write a 'Monitor' section for each output and specify these monitors in 'Device' section.

Below is a example snippet in xorg.conf.

Xrandr Graphical Front End GUI

Not recognised video cards

It is possible, that resolutions higher than 1024x768 (or 800x600.. 640x480) are not avalaible by default, because the videocard isn't recognised propely. If you can add and apply the desired undetected resolution(s) dinamically with cvt and xrandr, but you get an error after applying static changes to xorg.conf, etc/gdm/init/default, or .xprofile etc. & reboot, something like 'Stored settings can't be applied to monitors, any of the selected modes are not compatible with avalaible modes.. trying modes to 79.CRTC..', than You could try forcing X to recognize the video RAM.

Use your favorite text editor as root: (open a terminal)


and put this in the newly created file:

This tells X that there is 10000 kB (~10 MB) of video RAM, enough for 1920x1200 at 4 bytes per pixel. You can replace '10000' above with the amount of avalaible video ram. Save and reboot. (Remove the 99-vesahack file if it doesn't help.)

Adding undetected resolutions

Due to buggy hardware or drivers, your monitor's correct resolutions may not always be detected. For example, the EDID data block queried from your monitor may be incorrect.

If the mode already exists, but just isn't associated for the particular output, you can add it like this:

If the mode doesn't yet exist, you'll need to create it first by specifying a modeline:

You may create a modeline using the gtf or cvt utility. For example, if you want to add a mode with resolution 800x600 at 60 Hz, you can enter the following command: (The output is shown following.)

Then copy the information after the word "Modeline" into the xrandr command:

After the mode is entered, it needs to be added to the output using the --addmode command as explained above.

Setting xrandr changes persistently

There are several ways to make xrandr customizations permanent from session to session: a) .xprofile, b) kdm/gdm, c) xorg.conf. Each of these mechanisms will be discussed in turn.

Setting xrandr commands in .xprofile

A user's ~/.xprofile file is executed on Xorg startup if it exists and is executable. You can copy and paste xrandr command line strings into this file so they're executed when you log in. For example:

There are two disadvantages to using .xprofile for xrandr settings. First, it occurs fairly late in the startup process, so you'll see some resolution resizing during the initial screen draw; in some cases panel windows may resize improperly as a result. Second, as this is a per-user setting, it won't affect the resolutions of other users, nor will it alter the resolution on the login screen.

Setting xrandr commands in kdm/gdm startup scripts

Both KDM and GDM have startup scripts that are executed when X is initiated. For GDM, these are in /etc/gdm/ , while for KDM this is done at /etc/kde4/kdm/Xsetup. In either case, you can paste in an xrandr command line string into one of these scripts. For GDM, try putting them right before

in /etc/gdm/Init/Default.

This process requires root access and mucking around in system config files, but will take effect earlier in the startup process than using .xprofile, and will apply to all users including the login screen.

Setting resolution changes in xorg.conf

While xorg.conf is largely empty these days, it can still be used for setting up resolutions. For example:

See man xorg.conf for full details on how to craft an xorg.conf file.

Setting resolution changes in xorg.conf -- resolution lower than expected

Try this first

If you video card is recognized but the resolution is lower than you expect, you may try this.

Background: I use Ubuntu 9.0.4 x86, ATI X1550 based video card and two LCD monitors DELL 2408(up to 1920x1200) and Samsung 206BW(up to 1680x1050). Upon first login after installation, the resolution default to 1152x864. xrandr does not list any resolution higher than 1152x864. You may want to try editing /etc/X11/xorg.conf, add a section about virtual screen, logout, login and see if this helps. If not then read on.

Change the default xorg.conf


Section "Monitor"
        Identifier      "Configured Monitor"

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
->        SubSection "Display"
->                Virtual 3600 1200
->        EndSubSection

Section "Device"
        Identifier      "Configured Video Device"

About the numbers: I put DELL on the left and Samsung on the right. So the virtual width is of sum of both LCD width 3600=1920+1680; Height then is figured as the max of them, which is max(1200,1050)=1200. If you put one LCD above the other, use this calculation instead: (max(width1, width2), height1+height2).

If that does not help, here's what I did:

Use cvt/xrandr tool to add the highest mode the LCD can do

The actual order was different, as I tried to add new mode to one LCD at a time. Below is the combined/all-in-one quote

Goto Ubuntu Menu: System -> Preference -> Display

Change one of the LCD's resolution to a lower one, e.g. 800x600. Apply change, then (I don't remember the exact order/wording here:) hopefully the GUI will give you a prompt saying something like "the resolution can be improved but virtual screen has to be enabled, you need to however logout and log back in". I did it and on 2nd login, I am able to find the higher resolution listed for that LCD. After that I follow suite and make similar change to 2nd LCD and am able to get both of them working.

Obtaining modelines from Windows program PowerStrip

X.Org Wiki has an article about this.

X/Config/Resolution (last edited 2013-02-01 14:19:52 by uusijani)