Ubuntu 11.10 – dual monitor set-up not saving

Dual monitor settings in Ubuntu are clumsy at best. I have tried set ups on numerous machines and I find the most reliable method is to change the monitors.xml file. For more information on monitors.xml, check out the Ubuntu Wiki on Resolutions.

 First of all lets open up a terminal:

Now lets navigate to the folder where monitors.xml is stored:

You need to open the file in a text editor, we’ll use Ubuntu’s native editor, gedit:

Choosing your primary monitor

You will have something like the text below. There is only 2 words that you will have to change in the file, possibly 3.  (the <……..> is for display purposes only, you will have a few more lines of content in there)

  1. First make sure that the clone tag says “no” – <clone>no</clone>. if you don’t have this line, create it on the third line.
  2. Next, make sure the <primary>yes</primary> is on the correct output. If it isn’t change it, but make sure you change the other to “no” as above.

Now restart your computer or restart X and it will load up with the correct monitor settings.

NOTE – This will only take effect after you have logged in. LightDM has its own monitor settings (that I will be posting soon).

Setting monitor positions

Monitors.xml also specifies the position of your monitors.

The <x> and <y> values determine the position. They are based on the distance from the top left corner of the screen and are measured in pixels.

This set up includes a 22 inch monitor on the left, and 17 inch monitor on the right.

As you can see above, the first output device (or monitor!) has an <x> value of 0 (<x> is the horizontal position). The second output has an <x> value of 1680, which is equal to the <width> of the first output. This positions the secondary monitor 1680 pixels from the left – on the seam of the first monitor.

If you have some height differences in the position of your monitor you would need to edit the <y> value of the appropriate monitor.

As with any changes to this file, you will need to restart your computer or restart X  to make these corrections apply. They will take effect after you have logged in as LightDM has its own monitor settings (coming soon).

Change dual monitor resolutions

You can see a complete version of the monitors.xml above, but the only part needed here is this:

These 2 lines set the resolution for the output devices (your dual monitors!). Set them appropriately for each of your devices. Sometimes your proprietary graphics drivers/software will fail to modify this file causing some conflicts. You should change this to match any settings you are specifying elsewhere.

Remember to restart your computer or restart X  to make these corrections apply.

  • Torsten Regener

    Wow, thanks so much. WTF isn’t that part of the Display system configuration dialogue as in any other OS?! I mean, there is a reason for that …

    • Anonymous

      I think the dialogue is meant to do this and essentially sets this file but for some reason sometimes it just doesn’t work! I’ve had so many test systems over the years and its only recently I found out about this file. But then again before I was changing xorg.conf that isn’t around any more!

  • Anonymous

    This sounds like what I need to do to fix my problem but I have no monitors.xml file. I’m running 11.10.

    • Do you have the ATI or Nvidia proprietary drivers installed? these can sometimes delete the monitors.xml file.

      • ubuntu

        the what should be done if monitors.xml is not there ?

  • Gama Freire

    Hello, This is one good new thing in 11.
    However, my configuration is two monitors with 1024 and 1280 and if I put
    the second monitor in 1024 the system boots in clone saying that the with limit is 2048.

    How could you put your’s? I needed to put the second below the first and not to the right.

    Many thanks in advance and a Like to you.

    FGF gama.freire.at.gmail.com

  • Hi Gama,

    Thanks for the like ?

    try putting your primary monitor (top) at:

    And your second monitor (bottom) at:

    I’m guessing the resolution of your top monitor is 1024×768.

  • jolan

    Thank you for this tip. Never knew I had this file on my system. It solved all my problems with dual monitors.

  • Martin

    I have my primary display on the right. And got the primary thing setup right, but I have to move through the right edge of the right screen to get to the left screen, and vice versa… How do i fix that? ?