Changing X11 resolution on the fly

Posted by Steve on Tue 2 Aug 2005 at 10:01

The X11 "rotate and resize" (Xrandr) extension allows you to resize, or rotate, your current display on the fly. Whilst it's not supported for all drivers it's very useful when it does work.

Resizing can be useful in several circumstances:

The best way to see if your driver has this support enabled is to look at the logfile which your X11 server makes when starting up. The logfile will be in /var/log, and will be most likely be called either Xfree86.0.log for users running xserver-xfree86, or Xorg.0.log for people who have upgraded to X.org's server.

If support is enabled then you'll see the following lines:

(==) RandR enabled
(II) Initializing built-in extension RANDR

Once you've checked that you have the support (many drivers do - if you're using Vesa you're out of luck I believe) you can now attempt to resize your display.

The command to interface with the extension is called xrandr, and is part of the xbase-clients package.

The basic usage is as follows:

skx@mystery:~$ xrandr --size 1280x1024

Or for the perverse:

skx@mystery:~$ xrandr --size 800x600

Obviously you cannot raise yourself to a resolution that your current graphics card and display do not support!

Running the command with no arguments will give you the current list of supported resolutions:

skx@mystery:~$ xrandr 
 SZ:    Pixels          Physical       Refresh
*0   1280 x 1024   ( 342mm x 271mm )  *60  
 1   1280 x 960    ( 342mm x 271mm )   60  
 2   1024 x 768    ( 342mm x 271mm )   75   70   60  
 3    800 x 600    ( 342mm x 271mm )   75   72   60   56  
 4    640 x 480    ( 342mm x 271mm )   75   73   60  
 5   1280 x 800    ( 342mm x 271mm )   60  
 6   1280 x 768    ( 342mm x 271mm )   60  
 7   1280 x 720    ( 342mm x 271mm )   60  
 8   1024 x 576    ( 342mm x 271mm )   75   60  
 9    960 x 600    ( 342mm x 271mm )   60  
 10   960 x 540    ( 342mm x 271mm )   60  
 11   768 x 576    ( 342mm x 271mm )   56  
 12   720 x 576    ( 342mm x 271mm )   56  
 13   856 x 480    ( 342mm x 271mm )   60  
 14   848 x 480    ( 342mm x 271mm )   60  
 15   800 x 480    ( 342mm x 271mm )   75   60  
 16   720 x 480    ( 342mm x 271mm )   61  
 17   640 x 400    ( 342mm x 271mm )   72  
 18   512 x 384    ( 342mm x 271mm )   60  
 19   400 x 300    ( 342mm x 271mm )   60  
 20   320 x 240    ( 342mm x 271mm )   61  
 21   320 x 200    ( 342mm x 271mm )   71  
Current rotation - normal
Current reflection - none
Rotations possible - normal 
Reflections possible - none

To adjust the rotation of your screen you use the -o flag, as follows:

skx@mystery:~$ xrandr  -o inverted

For other rotations use "left", "right", "normal". These are explained if you run "xrandr -help" as follows:

skx@mystery:~$ xrandr -help
usage: xrandr [options]
  where options are:
  -display  or -d 
  -help
  -o 
            or --orientation 
  -q        or --query
  -s /x or --size /x
  -r  or --rate 
  -v        or --version
  -x        (reflect in x)
  -y        (reflect in y)
  --screen 
  --verbose

Not all drivers will support rotations, but if yours does it's interesting to experiment with inverted displays...


This article can be found online at the Debian Administration website at the following bookmarkable URL (along with associated comments):

This article is copyright 2005 Steve - please ask for permission to republish or translate.