Rotating One Monitor with Ubuntu


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_
#!/bin/bash XLIBSKIPARGBVISUALS=1 gnome-terminal2 $@
Save the file and make it executable
chmod +x /usr/bin/gnome-terminal
Now, everything should work correctly.

Update 10/28/08: 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.

Comments

Written by Nathan -

Could you please post a copy of your final xorg.conf file? I'm working with four monitors and I think it would help me to see things in context. Thanks

Written by Chris -

Sent - check your email. Best of luck.

Written by gor -

was looking for something like this, exact same setup only using laptop + lcd (want to rotate lcd) q_ does using xinerama disable composite desktop?

Written by Pat -

Hi - as a previous person who had commented said, could you please post your xorg.conf? I also would like to have a look as I can't get it to work with this description, and I'm sure there are many other people as well who are too lazy to post or email you for the solution...but if you don't want to post it, an email would be cool too ;) Thanks.

Written by Chris -

Sure. I didn't expect this post to be that popular. See above for an update.

Written by hk -

Hi. I too value the setup very much for coding, my problem is that I code openGL apps, so I need the performance. When you say that the composite extension is disabled, does this mean no 3d accel? thank you for a good post!

comments powered by Disqus