Ubuntu (and Linux in general) has a lot of things going for it. Running dual monitors, however, is not one of them. Speaking from personal experience, it is easy to waste several hours trying to get your dual monitor setup to work correctly. After playing around with various solutions, I have finally found one that works – at least for me.
I am running Ubuntu 10.04 and have two Dell monitors plugged into my computer’s add-on graphics card. The main monitor (1920×1080) uses the DVI connection while the secondary monitor (1440×900) uses the VGA connection. For whatever reason, the built-in monitor functionality under System->Preferences->Monitors kept crashing my monitors whenever I tried to make any changes. So, instead of using the GUI to set up my monitors, I resorted to the command line.
It turns out that the xrandr command is actually quite easy to use. I referenced my information from this site, but posted a few of the most useful commands below. These commands are all entered in the terminal.
To see the current monitor configuration type
xrandr. An example output is shown below:
mark@markacl:~$ xrandr Screen 0: minimum 320 x 200, current 3360 x 1080, maximum 4096 x 4096 VGA-0 connected 1440x900+1920+180 (normal left inverted right x axis y axis) 408mm x 255mm 1440x900 59.9 + 75.0* 1280x1024 75.0 60.0 1280x800 59.8 1152x864 75.0 1024x768 75.1 70.1 60.0 832x624 74.6 800x600 72.2 75.0 60.3 56.2 640x480 72.8 75.0 66.7 60.0 720x400 70.1 DVI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 298mm 1920x1080 60.0*+ 1280x1024 75.0 60.0 1152x864 75.0 1024x768 75.1 60.0 800x600 75.0 60.3 640x480 75.0 60.0 720x400 70.1 S-video disconnected (normal left inverted right x axis y axis)
If the primary screen (the one with the links on top and such) defaults to the wrong monitor, you can change it by using the
--primary command. For instance, if you wanted your VGA output to be primary, type
xrandr --ouput VGA-0 --primary
To change the position of your two screens with respect to each other use the
--right-of commands. For me to get my VGA monitor on the right of my DVI, I used
xrandr --output VGA-0 --right-of DVI-0
Also, you can change the position of the monitors to get just the right orientation with respect to each other. To get my second monitor to line up with the bottom of my first monitor, I used
xrandr --output VGA-0 --pos 1920x180
The position function relates to the upper left pixel of the monitor. I wanted my second monitor 1920 pixels left of my first (the width of the first) and 180 pixels lower (1080 – 900).