How To Rotate The Screen in Ubuntu With The Nvidia Driver

If you’re using the proprietary Nvidia graphics driver in Ubuntu Linux, your system has the ability to rotate the video display. Why would you want to do this? Well, I have an HP w2207 wide screen monitor that can rotate into portrait mode. This can be handy for editing long documents or working with portrait images in the GIMP.

Enable Nvidia Screen Rotation

Now, for some reason, screen rotation is not enabled my default in Ubuntu’s implementation of the Nvidia graphics drive, but that’s easy enough to change. You just need to add one line to your xorg.conf file. First, we’ll make a backup of the file.

[term]cd /etc/X11
sudo cp xorg.conf xorg.conf.bak[/term]
Now we’ll edit the file.
[term]sudo gedit xorg.conf[/term]
Now find the Device section that includes the line:
[term]

	Driver	"nvidia"

[/term]
Now add the line:
[term]

	Option	"RandRRotation"	"on"

[/term]
This is what my device section looks like after the edit (your file may have more lines in it).
[term]

Section "Device"
	Identifier	"Default Device"
	Driver	"nvidia"
	Option	"NoLogo"	"True"
	Option	"RandRRotation"	"on"
EndSection

[/term]
Now save the file, log out, and log back in (this is to restart the X server).

Rotate the screen with xrandr

Now that you have screen rotation enabled, you can rotate the screen with the xrandr command.
To rotate to the left, use:
[term]xrandr -o left[/term]
To go back to normal, use:
[term]xrandr -o normal[/term]
To rotate right:
[term]xrandr -o right[/term]
Or to flip the screen upside down:
[term]xrandr -o inverted[/term]

GUI Configuration Tools

There are also some handy tools for the GUI if you prefer. There is a GNOME panel applet (Display Geometry Switcher) that you can install.
[term]sudo apt-get install gnome-randr-applet[/term]
There is also grandr.
[term]sudo apt-get install grandr[/term]
This will add an item to the menu under System→Administration→Multiple Screens.

23 thoughts on “How To Rotate The Screen in Ubuntu With The Nvidia Driver

    1. Linerd Post author

      Thanks for the comments. I’ve pretty much given up on Unity. Too many things are broken and I can’t get used to the interface. I’m now using Kubuntu 12.04 on my desktop and Mint 13 on my netbook.

      Reply
  1. mrG

    As of Ubuntu 12.05, it seems the xrandr method is broken under Unity šŸ™ — I can rotate the screen using the xorg.conf or by using the desktop screens admin utility, but xrandr -o right will turn the screen for a fraction of a second, and then it reverts to landscape. Anyone have any ideas what might be thwarting this approach?

    Reply
  2. Ruvi

    Well it worked, and i am happy about it!
    though I couldn’t find “driver “nvidia”” section there was only one section on my xorg.conf file, so i added it there it there and viola it worked. Thanx

    Reply
  3. mrG

    This worked in so far as it enables the rotation option on the screen menu, but attempting to set the orientation with grandr gives the error that the user set size is larger than the screen size.

    In a previous revision of Unity the screen config gave me the option to place an icon on the desktop to rotate the screen, but this options does not appear now and the gnome applet you mention here is no longer found in the 11.10 apt collection. Any idea where it went?

    Reply
    1. Linerd Post author

      I’m still running 10.04 on my main machine. I’ve messed around with 11.10 a bit, but I haven’t gotten into it too far. I didn’t mess with 11.04. Sorry I can’t help. I guess you can add it to the list of things that you can’t do in Unity.

      Reply
  4. Isleif Otero

    Just after installing Ubuntu 11.10, I thought that the issue of screen rotation on nvidia drivers was solved but trying those drivers offered by Ubuntu, did not do the trick, Now that I discovered this workaround my Ubuntu 11.10 is now perfect for me. I have one of those weird HP Pavilion xt2110us Tablet PC Notebooks and Ubuntu worked like a charm. I just asigned the commands with the keyboard application and get all set.

    Thank you

    Good work. šŸ™‚

    Reply
  5. Rev. Alfred Haines

    The right/left and above/below are flipped respectively. above is now left.

    Works nice but I also have 2 monitors and would like one landscape and other horizontal.
    my 32″ doubles as a ps3 monitor and I can’t rotate that, or can I?

    Nice work! šŸ™‚

    Reply
  6. v santhosh

    My mouse pointer works in a weird way. I have two monitors and rotated both of them but mouse behaves in a weird way. I have to bring the pointer below the first screen to get it to the second screen which is undesirable. I would want to move the monitor sideways.

    Reply
  7. coakley

    How do I arrange set up so one screen is landscape and the other is horizontal? Right now it flips both.

    Reply
    1. anuj

      I also have 2 monitors and have been trying to get one landscape and other horizontal. Tried searching a lot in net to find a solution but couldnt. Does anybody have any idea how to do tht?

      Reply
    2. Matt

      I think that the only hope for doing this (at least with the current version of xorg) is to set them up as separate X screens, and even then I’m not sure how to do it/if it is possible. I’ve done quite a lot of looking around on this, and concluded that it is not possible to do when using twinview or Xinerama.

      It’s frustrating, since windoze can do it no problem.

      Reply
  8. Ian

    tried this with success until i log out, upon login it is sideways as before, basically the setting do no stay for both methods, have a nvida gforce 8500 sand two monitors in portrait mode

    Reply
    1. Linerd Post author

      You could add something to your session startup programs. Go to System->Preferences->Startup Applications. Click on Add. Give it whatever name you want. In the command field, just enter whichever command you use to set your portrait orientation, (for example, xrandr -o left), then click Save. Now log out and log back in. Your desktop should now be rotated in the proper orientation. If you’re not set to auto login, the login screen will still be in its normal orientation rather than portrait. I don’t know how to take care of that.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.