Header Shadow Image

Graphics and Video: Changing the graphics/video resolution with xrandr


How do I change my screen resolution?  Changes made in the GUI control panel option in KDE 4.0 are just not sticking or are not becoming permanent / saved.


In Fedora 9 and higher you can navigate to the Display in this manner:
(CAUTION: Clicking ‘Display’ below may reset your video as it automatically runs):

  1. Start / KDE Menu
  2. Applications
  3. Settings
  4. System Settings
  5. Display

But in testing I found that for KDE 4.0.X I couldn’t apply the settings at all.  Maybe a bug at this time.  However, there is also a command called xrandr that can change the resolution of your desktop on the fly from the command line.  Without parameters, it will print available settings.

Here are the results of running xrandr without any parameters:

$ xrandr
Screen 0: minimum 320 x 200, current 1152 x 864, maximum 1600 x 1200
VGA-0 connected 1152×864+0+0 (normal left inverted right x axis y axis) 338mm x 270mm
1152×864       75.0*+   75.0     70.0     60.0
1280×1024      60.0 +   75.0     60.0     60.0
1600×1024      60.2
1400×1050      60.0
1440×900       59.9
1280×960       60.0
1360×768       59.8
1024×768       75.1     75.0     70.1     60.0
832×624        74.6
800×600        72.2     75.0     60.3     56.2
640×480        75.0     72.8     72.8     75.0     66.7     60.0     59.9
720×400        70.1
DVI-0 disconnected (normal left inverted right x axis y axis)
S-video disconnected (normal left inverted right x axis y axis)

To make the above permanent, edit ‘/etc/X11/xorg.conf‘ and add something similar to what you see below under the “Screen” section, selecting the appropriate resolution:

Section “Screen”
Identifier “Screen0″
Device     “Videocard0″
Monitor    “Monitor0″
DefaultDepth     16
SubSection “Display”
Viewport   0 0
Depth     16
Modes    “1280×1024″ “1152×864″ “1024×768″ “800×600″ “640×480″

To get a list of actions the script would take use:

$ xrandr –dryrun -s 1280×1024

CAUTION: When making changes to the video resolution, it’s possible you can hit a resolution outside your monitors range.  A message Out of range on the monitor may be printed as it was the case here when using xrandr -s 1280×1024.  One possible way to get out of this situation when you are stuck in a mode you can’t get out of is to use this trick. (NOTE: See safer solution further down.)  Run xrandr -s <RESOLUTION> for a resolution you know works.  Next run xrandr -x <UNTESTED RESOLUTION>.  If you get stuck, press the up arrow key twice and hit enter (though you will not see anything as your monitor will be blank due to the bad resolution).  Above set of steps will revert you to your last known working resolution (1280×1024):

$ xrandr -s 1280×1024
$ xrandr -s 1600×1024
$ xrandr -s 1280×1024 (UP arrow twice + Return/Enter key)

The above code will bring you back to the last known working resolution in the event that the second command typed doesn’t work.  The problem with the above method is that you are working in the dark.  A safer approach and to similate a preview effect, we can add a timer in the above likeas in the below code that will automatically revert to a working setting when the time has expired.  Here is the slightly more automated and SAFER way doing just this:

$ xrandr -s 1600×1024;sleep 10;xrandr -s 1280×1024

What it will do is change the resolution to 1600×1024, sleep for 10 seconds then change it back to 1280×1024.  This would be equivelent to the Windows resolution test option under Display.  :)

Hope this helps!

Leave a Reply


  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License