Ubuntu’s support for graphical displays has come a really long way. In Hardy 8.04, most of the configuration is handled through a GUI that works very well, in my experience. There are still a few edge cases that require a little manual configuration, though. Today I ran into one of them.
I have two monitors at work, and today I decided to rotate one of them to a vertical orientation. It’s nice for coding, because I can see many more lines of code at once. The other one I like to keep widescreen. Here’s how to accomplish this using an Nvidia dual-headed card, the nvidia proprietary driver (not nv), and two Dell flatscreen monitors.
Assuming you already have your monitors set up and working with the nvidia driver, start by backing up your xorg.conf. If something goes wrong, you can always restore this and be back where you started.
sudo cp /etc/X11/xorg.conf etc/X11/xorg.conf.bck
Then, fire up nvidia-settings from the terminal. Under “X Server Display Configuration”, make sure that you’re using “Separate X screen” and not “Twinview”. Twinview works great when the monitors are in the same orientation, and even gives slightly better performance, but didn’t allow me to rotate just one of the monitors. Check the box that says “Enable Xinerama”, and then write the changes to your X Configuration file.
Now, for the rotation:
sudo emacs /etc/X11/xorg.conf
In the appropriate “Monitor” section, add the lines:
Option "RandRRotation" "on"
Option "Rotate" "CCW"
Change “CCW” to “CW” for clockwise, instead of counter-clockwise.
Save the file, hit CTRL-ALT-Backspace to restart your Xserver, and you should be seeing the results. Great! Well, almost great…
There’s just one problem. There’s a known bug where gnome-terminal doesn’t work properly when nvidia composite drivers are enabled. The first solution in that thread (disabling the composite) didn’t work for me, so I did the following workaround that sets some environment variables every time the terminal is launched. Hit ALT-F2 and type “xterm” (since we can’t use gnome-terminal), then do the following:
sudo mv /usr/bin/gnome-terminal /usr/bin/gnome-terminal2
sudo emacs /usr/bin/gnome-terminal
In the new file you’re now editing, paste the following:
XLIB_SKIP_ARGB_VISUALS=1 gnome-terminal2 $@
Save the file and make it executable:
chmod +x /usr/bin/gnome-terminal
Now, everything should work correctly.
Due to popular demand, my xorg.conf is now posted here. It’s important to note that using Xinerama disables the composite extension, so compiz eye candy (aka advanced desktop settings) will not work. Fortunately, I value the setup for coding far more than I value shiny spinny desktop cubes.