Configuring Pivot/swivel under Gnome

This page describes how to configure the Pivot or swiveling of the display under X. Many newer LCDs have this ability (some even has a switch so the monitor can notify the system when the screen is rotated - but these features will not be discussed here). This allows the monitor to be in a portrait orientation which can be helpful for viewing larger quantities of text (in partucular PDFs that are normally in this orientation).

This should work with any monitor (but of course is more useful if the monitor can be physically rotated). I have tested it with my nVidia Ti4200 card (using DVI), but I have reason to believe that it is mostly the driver and X server that needs to support it, rather than the card itself. For the record, this was tested on 7.0-r1 with nVidias proprietary driver (version 1.0.8762).

The new monitor

Today I got my new monitor. I have been looking for an LCD that would go beyond 1280x1024 that seems to be the de-facto standard. With my 19" Hitachi monitor I have been running 1600x1200 for as long as I can remember, and I really like the ability to have some more space for all those windows. In particular when dealing with graphics, it is nice with the higher resolution. But most of the people I talk to are Windows users, and run at a lower resolution because otherwise "their fonts get so small that they cannot read them". Aparently people do not realize that the font sizes can be changed (and probably should be on any decent monitor). The default font sizes in Windows was selected back when 800x600 was a high resolution. Although windows has options for selecting normal, large and extra large fonts, I found out that I actually wanted something in between normal and large. So I manually adjusted the font sizes just a notch upward, and all was good.

Back to the story of my new monitor. The last time I looked (probably a year or two back), the only flatscreen monitors available that could do 1600x1200 were high-end and at least 21". They were also totally out of my price league, with the cheapest arround DKR 15.000 (more than $2.000).

Then the other day I was discussing this issue with a friend. I cannot understand why I can easily get a laptop with a screen that does 1400x1050 or even higher resolutions (especially if you go for a widescreen laptop), and these displays are only 15.4".

As we were discussing these issues, we went online and looked at the prices of LCDs. Although I was right about not being able to get an LCD that would go above 1280x1024 and still being smaller than 20", the prices of the 20" LCDs had taken a serious plunge since I last checked on them. So the same evening I decided to go ahead and order a Samsung SyncMaster 204B. I paid arround DKR 3.700 for it, including VAT and shipping.

Well, I picked it up at the post office today, and had to immediately hook it up. Not sure about how everything would work out switching to DVI and with a different refresh-frequency, I decided to boot in Windows first. No problem - the graphics card worked with the DVI connection right away, and Windows even detected the requirement for a slightly lower refresh rate. I then installed the drives from the CD that came with the monitor, and then I noticed that a small utility was installed that allowed the desktop to be rotated. The monitors stand has the ability to swivel to a portrait orientation, which is supposedly pretty nifty if you need to read larger amouns of text (previewing documents etc). I played arround with it a bit, and found it quite amusing.

Using RandR under Linux

Then came the time to reboot in Linux. I wasn't quite sure how this would work out, but there was no problem at all. Just as Windows had done, Linux (or the X server to be more specific) detected the monitors capabilities and switched to the appropriate refresh frequency. Since this worked out so smoothly, I decided to see if it would be possible to use the swivel-function under Linux as well. My hopes weren't too high, since I have always thought that changing the resolution of the X server was a pain in the butt. It used to be possible to change the resolution, but the desktop and window manager would still use the original (maximum) size, so the desktop was panned by moving the mouse. For the window manager to run at a different resolution, the configuration changes had to be made, and the X server restarted. Well, that was how it used to be.

Please note that I recently switched to modular X (Xorg X11 7.0), so I do not know if the RandR extensions are only available in these newer X servers. If you have any information, please drop me a note.

A quick search on google told me that I needed to use RandR (the X Resize and Rotate Extension). I tried installing xrandr but found out it was already installed. Then I tried to use xrandr to change the resolution.

To list the modes supported, and change to 1024x768:

[spiff@spiffship ~]$ xrandr
 SZ:    Pixels          Physical       Refresh
*0   1600 x 1200   ( 411mm x 311mm )  *60
 1   1280 x 1024   ( 411mm x 311mm )   75
 2   1152 x 864    ( 411mm x 311mm )   75
 3   1024 x 768    ( 411mm x 311mm )   75
 4    800 x 600    ( 411mm x 311mm )   75
 5    640 x 480    ( 411mm x 311mm )   75
Current rotation - normal
Current reflection - none
Rotations possible - normal left inverted right
Reflections possible - none
[spiff@spiffship ~]$ xrandr -s 3

This worked fine, but when I tried to use the rotate function, I got the following error:

[spiff@spiffship ~]$ xrandr -o 1
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  158 (RANDR)
  Minor opcode of failed request:  2 (RRSetScreenConfig)
  Serial number of failed request:  12
  Current serial number in output stream:  12

It turned out that although the nVidia driver I use (nvidia-drivers-1.0.8762-r1 under Gentoo Linux) supports the rotation of the desktop, it needs to be enabled first. So I added the following line to the Device-section for the graphics-card (in /etc/X11/xorg.conf):

        Option "RandRRotation" "on"

After restarting the X server, everything worked as expected. The desktop can now be rotated by the command:

[spiff@spiffship ~]$ xrandr -o 1


After verifying that it works, the icing on the cake is to bind some hotkeys for the rotate functions. I am currently back to running Gnome (with Metacity), mainly due to fluxbox having hard-coded that holding the alt-key while clicking on a window moves it. This means that the click-event is not sent to the application, which conflicts with the use of alt to select an alternative grid in Eagle. I have also been experimenting with Xgl, which is extremely cool, but unfortunately still a bit unstable for my use.

So with Gnome and Metacity, global keybindings are made through the Configuration Editor gconf which is found in the Gnome menu under ApplicationsSystem ToolsConfiguration Editor. Or hit alt-F2 and type gconf-editor.

Under appsmetacityglobal_keybindings you put the keybindings (as one of the run_command_* keys). I have set the following bindings:

command numberKeybinding

This corrosponds roughly to the keybindings used in the windows utility that came with the monitor (MagicRotate), but can be changed to any key-combination you desire.

When the keys are bound, go to appsmetacitykeybinding_commands and set the commands to run when the hotkeys are pressed. I use the following configuration:

command numberKeybindingDescription
command_1/usr/bin/xrandr -o 1Rotate to portrait
command_2/usr/bin/xrandr -o 0Rotate to landscape

And that should be it. It is not necessary to restart X for this to work. As soon as the changes are made in gconf they should start working. Here is a picture of how the rotated desktop looks:

Linux desktop in portrait orientation
Last updated: 2006.07.10