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:
- When you've crashed a fullscreen SDL application, and your screen is in a "low resolution" state.
- When hooking up a high-resolution laptop to a low-resolution projector.
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: -displayor -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...
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Thanks
[ Parent | Reply to this comment ]
ctrl+alt+- down resolution :D
SAK
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
That does something different.
xrandr changes the physical/real resolution. Ctrl+Alt+[-+] changes the virtual resolution - a seperate thing.
If you try the two approaches you'll soon see the difference...
Steve
-- Steve.org.uk
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
--
http://youve-reached-the.endoftheinternet.org/
[ Parent | Reply to this comment ]
does anybody have an idea why this doesn't work with ATIs fglrx-driver and X.Org's server? I had it running nicely with XFree86 in Debian, but now on Ubuntu it won't work... Even though I have the following lines in the Log-file:
[...]
(==) RandR enabled
[...]
(II) Initializing built-in extension RANDR
[...]
Somebody got any idea what I could test further?
Thanks for the great articles,
ineiti
[ Parent | Reply to this comment ]
ineiti
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Good to know, thanks.
I run neither of the desktop environments at the moment, and it didn't occur to me to check.
Steve
-- Steve.org.uk
[ Parent | Reply to this comment ]
I've been looking for a way to switch resolutions on my MythTV-based HTPC - it's connected both to my TV and my Panasonic projector, and I'd really like to be able to switch resolutions with the remote...
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Or do I have to load new drivers?
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
I just wanted to point out that IMHO it is more elegant to use the following syntax to see if the xrandr is supported
xdpyinfo | grep RANDR
[ Parent | Reply to this comment ]
purchased a new monitor and still nothing.
can anyone help please?
[ Parent | Reply to this comment ]