[ltp] Switching X screen res's "on the fly"
Rob Mayoff
linux-thinkpad@linux-thinkpad.org
30 Sep 2003 11:13:34 -0500
+---------- On Sep 30, Crawford Rainwater said:
| I am using RedHat 9.0 with the 2.4.20-20.9 kernel for reference purposes
| with gdm running Gnome and KDE (using Gnome primarily). When I use the
| Gnome "System Settings" (aka redhat-config-xfree86) to do this, it
| crashes X, so I am stuck at 1600x1200 (which is not compatible with most
| LCD projectors of course).
First, all of the resolutions you want to use must be listed on the
"Modes" line of the "Screen" section of your /etc/X11/XF86Config. For
example, here's the "Screen" section of the XF86Config on my A30p:
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1600x1200" "1400x1050" "1280x1024" "1280x960" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Second, there are two ways to change X's resolution on the fly using
programs. The programs are "xvidtune" and "xrandr".
Most window managers let you bind keys to execute specific programs. To
do so in Metacity (the default Gnome WM in Redhat 9), use gconf-editor.
For example, set /apps/metacity/global_keybindings/run_command_4 to
"<Ctrl><Alt>slash" and set /apps/metacity/keybinding_commands/command_4
to "xvidtune -next".
xvidtune changes the video mode without changing the root window size.
So if you change to a resolution smaller than the size of your root
window, the physical screen acts as a window onto a larger virtual
screen, and scrolls when you try to move the mouse past a screen edge.
The commands to use are "xvidtune -next" and "xvidtune -prev".
xrandr changes the video mode and the root window size. The window
manager (if it supports the RANDR extension, which metacity does)
detects the change and moves windows as necessary if they'd be outside
the root window. The command is "xrandr -s N", where "N" is the mode
number, or "xrandr -s WxH", where "WxH" is the size.