Xrandr

From Freephile Wiki
Jump to navigation Jump to search

a little R and R[edit | edit source]

I use a notebook computer, and normally use it at my office which means that I use an external keyboard and mouse plus use two monitors to get a larger work area. The best way that I've found to setup a "dual head" environment is by using the XRandR utility. XRandR stands for "X Resize and Rotate" and is the extension to the X Server which allows you to re-configure the size and orientation of your desktop on the fly -- working with more than one physical display.

I have a Dell Inspiron 5100 notebook which is limited to 1024x768 resolution. It would be tough using that 8 hours / day trying to do anything substantial. Luckily I also have a ViewSonic VS11446 24" flat-panel monitor. The external monitor is capable of 1680x1050 resolution which is quite a bit of screen realestate. XRandR lets me connect the flat panel monitor to my notebook and create and even larger "screen" consisting of the two displays acting as one. I can drag and drop a window from one display to the other. In practice, it means that I can have a dedicated email/video/communication display while my main work area is on the flat panel.

And, if I want to disconnect the notebook and take it into the living room to watch the Red Sox vanquish the Tamba Bay Devil Rays, then a single command will disconnect the flat panel and resize all my application windows to fit onto the notebook display.

Hook up the notebook in the office again and a single command will put me back into "dual screen" mode.

Using XRandR[edit | edit source]

Hint: I store each of these commands as "bookmarks" in Konsole organized under "system configuration"

# grab resolution details
echo "xrandr -q:" > ~/resolution.txt && xrandr -q >> ~/resolution.txt

# dual screen
xrandr --output LVDS --auto --output VGA-0 --off; \
sleep 3; \
xrandr --output LVDS --auto --output VGA-0 --mode 1680x1050 --left-of LVDS

# external monitor OFF
xrandr --verbose --output VGA-0 --off

If you use the --dryrun option to xrandr, it will show you a numbered list of the modes it knows about. That number is the number you can supply to the --size argument.

So, if you have a slew of 20 resolutions supported by your video card (as seen in xrandr output), and the 20th one is the super duper 1900x1200 resolution you want, then issue an xrandr --size 20 to get the 20th mode. I hope this is clear. It certainly isn't clear from the man page. Unlike a plain xrandr command, the --dryrun option numbers the modes in the output so that you know (without counting) the mode index to supply to the --size option.

Note[edit | edit source]

Apparently in the newest Xorg, you barely even need an xorg.conf file, and xrandr is more central to the system

Resources[edit | edit source]

  1. http://www.x.org/wiki/Projects/XRandR
  2. http://www.intellinuxgraphics.org/dualhead.html
  3. http://en.wikipedia.org/wiki/Xrandr