What happened to my Ctrl-+/- zoom in Xorg?

Older X.org and XFree86 used to have this neat feature where pressing Ctrl+<numpad +> and Ctrl+<numpad -> would cycle through the screen modes defined in your config file in the “Screen” section, effectively switching screen modes on the fly and letting you pan around the full virtual screen size with the mouse.

This was a really useful feature for zooming in on small details, or to blow up videos without incurring high CPU overhead.

But since about X.org 1.7 this feature seems to be missing.  I’ve been researching and discovered why it’s missing, and what to do about it.

So why is it missing?

It’s part of an architecture change in X.org and Linux, to support screen-mode switching for suspend/resume on laptop computers and a few other stability problems and useability things. Also it has something to do with the “kvm” module in the Linux kernel I think.  (KVM doesn’t work with my Radeon driver, at least not the version included in openSUSE 11.2, yet openSUSE has it enabled by default in 11.2, but that’s another story).

What can I do about it?

You can look into screen magnifying software to make parts of the screen larger. Ew! (The whole point of switching screen mode is that the monitor does the magnification in hardware, rather than using the CPU or the GPU, so I can watch YouTube full-screen without the CPU having to multiply the pixels)

Alternatively this functionality is replaced by the new XRandR extension to X11. You can list the modes defined for your system, as well as the status of all your screens connected to your card with the command-line tool xrandr:


[~]archimedes$ xrandr
Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 3840 x 1200
VGA-0 disconnected (normal left inverted right x axis y axis)
DVI-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm panning 1280x1024+0+0
   1280x1024      60.0*+   75.0     60.0*
   1152x864       75.0
   1024x768       75.0     70.1     60.0
   832x624        74.6
   800x600        72.2     75.0     60.3     56.2
   640x480        75.0     72.8     66.7     59.9
   720x400        70.1
S-video disconnected (normal left inverted right x axis y axis)

So from above info I can see:

  • My LCDs native resolution is 1280×1024
  • This screen is identified as “DVI-0” to xrandr
  • The 1280×1024 mode is set as the Preferred mode (marked with a +) which makes sense because it matches the LCD
  • That mode is set as the Current mode (marked with a *)
  • I have a list of the other modes available, as well as supported refresh rates

Now I can change screen mode like this:

xrandr --output DVI-0 --mode 800x600 --panning 1280x1024

That keeps the virtual screen at the same size but the actual display mode is 800×600 (without the –panning switch, the virtual screen size changes to match the mode, which isn’t fun really).  I can switch back with:

xrandr --output DVI-0 --mode 1280x1024 --panning 1280x1024

Now all that remains is to bind these commands to keyboard shortcuts. The way to do that depends on the desktop environment you use. I’m still looking into how to do it for KDE and / or Awesome.

Oh, and if I ever plug my screen in via the VGA port, I’d need to change the “DVI-0” to “VGA-0” on my machine.

Advertisements

3 thoughts on “What happened to my Ctrl-+/- zoom in Xorg?

    • Thanks Miguel. I confess I had to resort to Bablefish to understand you 🙂 Here is what it rendered, by the way:

      Me one to the congratulations, the truth that seems to me that the content is enough…. Blog is very interesting your. they mugen-kan Karate Goju-ryu videoinformatica.net ip3122, cameras of security

  1. I’ve written a script for setting modes, that’s a simple wrapper around xrandr. You can call it with just one argument to select “low”, “medium” or “high” resolution. Get it here:

    Browser URL: http://gist.github.com/475388
    Git Clone URL: git://gist.github.com/475388.git

    Feel free to hack on this, or clone the repo and do what you like (as allowed by GPL 3).

    It should be fairly easy to assign global keys to this script. I’m settling for just typing Alt-F2 to bring up krunner, and then run it thay way. Reminds me of my old Amstrad 🙂

Comments are closed.