Changing X11 resolution on the fly

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

Tags: ,

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:
  -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...

 

 


Posted by Anonymous (217.133.xx.xx) on Tue 2 Aug 2005 at 14:20
great!

[ Parent | Reply to this comment ]

Posted by analogue (82.227.xx.xx) on Tue 2 Aug 2005 at 14:54
[ Send Message ]
Thanks, I didn't know about that.

[ Parent | Reply to this comment ]

Posted by Anonymous (129.10.xx.xx) on Tue 2 Aug 2005 at 17:18
I was looking for something like this .. no more fighting with projectors !

Thanks

[ Parent | Reply to this comment ]

Posted by Anonymous (80.224.xx.xx) on Tue 2 Aug 2005 at 18:37
ctrl+alt++ up resolution
ctrl+alt+- down resolution :D

SAK

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 2 Aug 2005 at 18:58
[ 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 ]

Posted by Anonymous (64.95.xx.xx) on Tue 9 Aug 2005 at 08:09
That's not correct. Xrandr can switch the video mode along with the dimensions of the root window. ctrl+alt +/- uses the VidMode extension to switch the video mode, but it can't change the dimension of the root window.

[ Parent | Reply to this comment ]

Posted by sneex (63.139.xx.xx) on Fri 11 May 2007 at 19:51
[ Send Message | View sneex's Scratchpad | View Weblogs ]
ctrl+alt++ doesn't always work =( As I am finding out using my HD LCD Monitor (which can support upto 1440X900@75) running Debian 4R0 Etch.

--
http://youve-reached-the.endoftheinternet.org/

[ Parent | Reply to this comment ]

Posted by Anonymous (122.161.xx.xx) on Thu 24 Jun 2010 at 05:53
Thanks dear , it works fine for me. As getting the same "Out of Range" issue, with newly installed Debian Linux india1 2.6.26-2-686.

Regards,
Praveen Sharma

[ Parent | Reply to this comment ]

Posted by ineiti (128.178.xx.xx) on Wed 3 Aug 2005 at 10:42
[ Send Message ]
Hi,

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 ]

Posted by Anonymous (81.221.xx.xx) on Sun 14 Aug 2005 at 15:56
Well, I installed xserver-xfree86, then xrandr works with fglrx (ati-driver). But xkb doesn't work anymore. Dunno why. XRandr vs. Xkb, chose one ;)

ineiti

[ Parent | Reply to this comment ]

Posted by kamaraju (128.84.xx.xx) on Wed 3 Aug 2005 at 16:24
[ Send Message ]
Awesome. Now I have to get hold of my Mac friend who boasts about this facility on Mac. Thanks for the article.

[ Parent | Reply to this comment ]

Posted by Anonymous (140.247.xx.xx) on Tue 4 Oct 2005 at 17:28
I think they can still boast, since they've been able to do it for over a decade. And with modern MacOS, it's more automatic and better integrated into the user experience in general than under Linux. For example, I'm not sure that with the current Xorg distribution that it's possible to plug in a second monitor and have it automatically detected, enabled, and configured for its optimum resolution.

[ Parent | Reply to this comment ]

Posted by Anonymous (2a01:0xx:0xx:0xxx:0xxx:0xxx:xx) on Fri 3 Sep 2010 at 15:52
it is possible. check the man for xrandr, you can do many things like activate an extra display that you just plugged in and move things around. the thing that might(maybe it exists) be missing is a userlol interface.

of course boasting about user interface to a macos guy is like a windows guy boasting about... .. about anything actually to anyone.

manu

[ Parent | Reply to this comment ]

Posted by grimoire (82.69.xx.xx) on Wed 3 Aug 2005 at 22:57
[ Send Message ]
KDE's "Screen Resize and Rotate" utility provides a graphical interface to this. I'm sure Gnome has an equivalent.

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Wed 3 Aug 2005 at 22:59
[ 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 ]

Posted by Janek (81.235.xx.xx) on Fri 5 Aug 2005 at 09:14
[ Send Message ]
Thanks, this is exactly what I needed!

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 ]

Posted by robstar (209.157.xx.xx) on Mon 2 Jan 2006 at 23:05
[ Send Message ]
Where can i find a list of drivers that actually support rotation? I have a dell 2405 LCD and i'd like to be able to occasionally edit tall photos vertically, but my current driver ("nv") only supports "normal" orientation.

[ Parent | Reply to this comment ]

Posted by Anonymous (70.50.xx.xx) on Wed 15 Feb 2006 at 00:54
I was using a really crappy monitor previously that only supported 800x600, now I've got a better one. Is there a way to ADD resolutions to this so that I can change it to 1024x768? Right now it doesn't show it as supported.

Or do I have to load new drivers?

[ Parent | Reply to this comment ]

Posted by Anonymous (71.237.xx.xx) on Sun 12 Nov 2006 at 08:21
You can add the resolutions to your xorg.conf file to get them to appear in the xrandr list.

[ Parent | Reply to this comment ]

Posted by Anonymous (212.76.xx.xx) on Tue 15 Jan 2008 at 09:49
thanks for a tip on xrandr.

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 ]

Posted by Anonymous (86.0.xx.xx) on Fri 6 Jun 2008 at 00:49
I just installed debian 4 and my monitor wont support the resolution. basically i've done the install and the most i can see is my mouse cursor, no menus nothing not even when i right click, tried cntl up down ect nothing. i cant access (dont know how to) get to the command promt from grub.

purchased a new monitor and still nothing.

can anyone help please?

[ Parent | Reply to this comment ]

Posted by Anonymous (125.161.xx.xx) on Mon 13 Oct 2008 at 10:31
i've got the same thing, my xorg.conf already have bigger resolution mode then 1024x768, but when i use xrandr it's only show 1024x768 nothing more. can help me figure out the problem?
it's because the monitor or the hardware (intel 825 IGP) that not supported?

tq

[ Parent | Reply to this comment ]

Posted by Anonymous (96.24.xx.xx) on Tue 1 Nov 2011 at 04:49
not sure if this is relevant, but for noobs like me, this method enables a virtual panning desktop on Debian, from a terminal command-line, without need for a xorg.conf:

xrandr --output VGA1 --rate 60 --mode 800x600 --fb 1280x1024 --panning 1280x1024

the "mode" is your viewport (ie, max res of your monitor). The "fb" and "panning" are both set to your desired virtual size.

This will not work if the "output" parameter is not your active graphics card. Find out your active graphics card by running xrandr on a command line, without any arguments.

You can switch back to normal resolution with the same command, with your actual screen resolution used for all the arguments.

Now you can quickly switch between panning and non-panning resolution by putting the two different commands into .sh files, and make them "executable" on the permissions tab of their file properties.

on my asus netbook, my commands are:

normal.sh
xrandr --output LVDS1 --mode 1024x600 --fb 1024x600 --panning 1024x600

tall.sh
xrandr --output LVDS1 --mode 1024x600 --fb 1024x768 --panning 1024x768

from:
https://wiki.ubuntu.com/X/Config/Resolution#Panning_viewport

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

Which init system are you using in Debian?






( 1059 votes ~ 6 comments )