Panning using xrandr

I had always been wondering, how can I reduce the size of my display to a smaller size, while keep the virtual size of my display to my current size, using a command.

“Wait, why would you need that?” You may ask. Well, that’s a secret trick that I’ve been playing for years —

When people playing videos, most people like to play in full screen mode, simply by switching to the full-screen playing mode from the video player. However, I never do that. Why?

Because I consider the method

  1. a waste of my CPU power
  2. a waste of the energy
  3. yields less than optimal result, no matter how good the video player can stretch the video.

About the point 3, with nowadays screen size, using my 1920×1080 screen as an example, playing a 640×360 video would mean stretching the video 3 times both horizontally and vertically. In other words, the video player has to magically come up with 9 pixels from a single pixel of the video. No matter what magic it is, we can tell that it either produces bad result, or use an outrageous amount of CPU power. Is there any better solution? Yes, using my trick.

May people know that our monitor can render more than one resolution, but few would use anything less than the highest resolution. Playing low resolution videos is the perfect time to use lower monitor resolutions — the video player play the video as is, without any stretching, while you are viewing (almost) full screen. I call the first method the software solution and mine as hardware solution.

Now the problem is how to do it? Wouldn’t

xrandr -s <width>x<height>

do the trick? Well, yes it does. But the problem is that when I restore my display to its original size, all exiting window are shifted, jam-packing the upper left corner of the display, and even gnome menu icons are shifted two. That’s awful.

Quick answer:

To reduce to a smaller display size,

xrandr --output VGA-1 --mode 640x480 --panning 1920x1080

This will reduce the size of my display to a smaller size (640×480), while keep the virtual size of my display to my current size. To view the other virtual display area, just panning with the mouse.

To get a list of display size can be used, use xrandr. Here is output of mine:

$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 4096 x 4096
VGA-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm panning 1920x1080+0+0
   1920x1080      60.0*+
   1280x1024      75.0     60.0
   1440x900       59.9
   1280x800       59.8
   1152x864       75.0
   1024x768       70.1     60.0
   800x600        60.3     56.2
   640x480        66.7     60.0
   720x400        70.1

It shows that the smaller sizes that I can use are, 1280×1024, 1440×900, 1280×800, …., 800×600, 720×400 and 640×480.

BTW, There is also an old X11 trick to change the screen resolution, Ctrl-Alt plus + or – from the number pad. That’s the trick that I’ve been playing for years. However, as you can tell, it’d be tiresome to do it now, because previously there’s about 3 modes that I can switch in between, and now it is tiresome to cycle through all the display mode above.

To restore,

xrandr -s 1920x1080

For details, read on.

documented on: 2011-02-02

Panning using xrandr_

Newsgroups: gmane.linux.debian.user
Date: Mon, 31 Jan 2011
> How to do panning using xrandr?
>  xrandr --panning <width>x<height>
> won't work -- I need to put --output <output> before --panning.


> The problem is, I've searched everywhere, but every possible string I
> tried didn't work.

Don’t guess; ask your device: “xrandr -q” will tell you the name of detected devices.


Panning using xrandr_

> Don't guess; ask your device: "xrandr -q" will tell you the name of

Perfect, thanks a lot.

Now the question that I really want,

How can I reduce the size of my display to a smaller size, while keep the virtual size of my display to my current size, using panning to view all virtual display. I tried below, but it didn’t work as I expected . . .

Panning using xrandr_

On Tue, 01 Feb 2011 20:38:50 +0000, Camaleón wrote:

>> all virtual display. I tried below, but it didn't work as I expected:
>>  xrandr -s 640x480 --output VGA-1 --panning 1920x1080
> Hum... if I understood correctly the xrandr man page, you should run
> something like:
> xrandr --output VGA-1 --mode 640x480 --fb 1920x1080 --panning 1920x1080

OMG! That’s perfect!

Thanks a thousand!!!

Just FTA, the –fb 1920×1080 is not really necessary. The relation between the “mode”, “panning” and “framebuffer” can be illustrated below,

┌──┳━━━━━━━━━━━━━━┳─────┬ ─ ─ ─ ─ ─ ┐
│  ┃     CRTC     ┃     │
│  ┃              ┃     │           │
│  ┃             X┃→    │
│  ┃              ┃     │           │  framebuffer
│  ┗━━━━━━━━━━━━━━┛     │
│                       │           │
│panning area           │
└───────────────────────┴ ─ ─ ─ ─ ─ ┘

If now –fb is specified, it default to the same size as panning:

│  ┃     CRTC     ┃            │
│  ┃              ┃            │
│  ┃              ┃→           │
│  ┃           X←→┃            │
│  ┃       border_right        │
│  ┗━━━━━━━━━━━━━━┛            │
│                              │
│panning area                  │


Thanks again


documented on: 2011-02-02

%% Panning using xrandr

%% Panning using xrandr

%% Panning using xrandr


10 thoughts on “Panning using xrandr

  1. At first it worked
    xrandr –output VGA-1 –mode 720×400 –panning 1600×1200
    But at the next try the panning with the mouse stopped working. I’m sure it will work when I restart again …

    Also isn’t it possible to statically set the available modelines in xorg.conf?
    I’d like to make a keyboard shortcut to pan since the old X11 trick doesn’t seem to work anymore.

  2. I don’t know why the mouse stopped working after a while. It never happened to me. I guess you have to try it more with different HW and SW (different distro and/or versions) to tell what is actually causing the problem.

    Also try to restore with

    xrandr -s 1920×1080

    then start again, and see if it works.

    Secondly, I think it is still OK to set the available modelines in xorg.conf, isn’t it? I don’t know, I’m really not an expert on this. As you can see, all my answers are gathered from here and there then piece them together.

    thanks for visiting.

  3. I would like to ask you something that has been bothering me for a while. What I wanna accomplish is to open two browser windows using the -new-window flag. So far so good, but I wanna open each window in a different external display (per instance, one browser displaying in a display connected in a VGA port and another displaying in a HDMI port)

    here is what I have done so far but Im sure there is a better way…please help.

    monitor1= xrandr | grep DisplayPort-0
    if [ -z $monitor1] ; then
    xrandr –output DisplayPort-0 –primary
    xrandr –output DisplayPort-0–pos 1920×0+0+0
    google-chrome -new-window </dev/null &>/dev/null &

    monitor2= xrandr | grep DVI-0
    if [ -z $monitor2] ; then
    xrandr –output DVI-0 –primary
    xrandr –output DVI-0 –pos 3840×0+0+0
    google-chrome -new-window </dev/null &>/dev/null &

  4. Thanks for your comment, Mauricio.

    Wow, you are so advanced already. There might be better ways, using ready-made packages for example, but I myself won’t install some several mega-byte packages just to do what several lines of shell script can nicely do. I don’t see anything wrong/any problem with the above solution. I would instead call it elegant. Put it in auto-start file if you want to start them when login into your desktop, or put them into separated aliases if you prefer command line, or put them in desktop/WM customized menus. I use fluxbox as my WM, and I have a few customized menus like this.

    This — using a few lines of shell script — is just the beauty of it. Otherwise, for the 3 cases I listed above, you might need to find three more ready-made packages to do it. So, people might have different ways to define “better ways”, but mine is with your current approach.

    Thanks again for sharing!

  5. And now the signal processor in your display has to come up with those 9 pixels from a single pixel. Or are you using an old CRT?

    • Not quite sure what your question is, but yes, the blog is from year 2011, when I’m using the CRT. That being said, even nowadays LED displays can still allow us to change the resolutions.

      • The difference is that an LCD scales your 640 x 480 signal to the display’s native resolution using the same or similar methods as your GPU would use, meaning that you gain no quality and hardly any power saving.

        Thinking about it a bit more, there is also some scaling with a CRT: For a 640×480 resolution, the scan ray does not flash 640 times per line (this would produce nice, round, small pixels) but burns constantly. Therefore, the chain from DAC over ray modulator and shadow mask to phosphor dots inevitable scales your video horizontally. One could also argue that there is vertical scaling as the ray also lights up vertically neighboring dots a bit. However, with 480 lines on a display ready for 1080 lines, the lines should not overlap but be separated by black lines (= dots the ray never visited).

        If you liked the look of your videos on your CRT but now have to use LCDs, an option would be to simulate the CRT process on the GPU and render the result on a 4K or 5K display. With touch sensors, you could even simulate the moire effects you get when you flick your finger on the screen. Of course, the simulation would use quite a bit of energy.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s