Getting started
What is xrandr?
xrandr
is a command-line tool to interact with the X RandR
extension [see x.org,
wikipedia], which allows for
live (re)configuration of the X server (i.e. without restarting it):
It provides automatic discovery of modes (resolutions, refresh rates,
etc.) together with the ability to configure outputs dynamically
(resize, rotate, move, etc.).What consequences for xorg.conf?
squeeze
, removing the xorg.conf
configuration file
entirely should work well enough, but in case that doesn’t work out,
let’s document what can be removed from it from a RandR
point of
view.-
HorizSync
andVertRefresh
from theMonitor
section.
-
Modes from
Display
subsection inScreen
section.
-
ModeLine
from theMonitor
section.
xorg.conf
:-
Drop dual
Device
/Screen
/Monitor
sections, a single one is needed.
-
Drop
MonitorLayout
option andScreen
lines from the remainingDevice
section.
-
Drop the
ServerLayout
section(s).
-
Drop
RightOf
/LeftOf
indication of the remainingScreen
line inServerLayout
section.
Basic xrandr usage
xorg.conf
) is removed or updated,
starting the server should enable some outputs by default. Their
top-left corners will be at the same part of the image, but their
modes will probably be different.xrandr
. To see the available
outputs, just run xrandr
:$ xrandr
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 4096 x 4096
VGA1 disconnected (normal left inverted right x axis y axis)
LVDS1 connected 1280x800+0+0 inverted X and Y axis (normal left inverted right x axis y axis) 261mm x 163mm
1280x800 59.8*+
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
DVI1 disconnected (normal left inverted right x axis y axis)
TV1 disconnected (normal left inverted right x axis y axis)
-
We see 4 outputs:
VGA1
,LVDS1
,DVI1
,TV1
.
-
Only the internal panel (
LVDS1
) is connected and it supports 4 modes at 60 Hz, 1 mode at 56 Hz.
-
The mode marked with a star (
*
) is the current mode.
-
The one marked with a plus (
+
) is the preferred one. Most monitors report a preferred mode to the driver. And the server/driver will generally choose it by default.
VGA1
output properties, you should use:$ xrandr --output VGA1
Other sample:
$xrandr --output VGA-0 --mode 1600x900 --rate 60.00
Adding/removing heads dynamically
RandR
1.2, you can plug/unplug monitors whenever you
want. Running the following line will query all outputs and enable
them with their default mode:$ xrandr --auto
$ xrandr --output LVDS1 --off
Changing the mode
xrandr
output, you may change the LVDS1
mode to
1024x768
using:$ xrandr --output LVDS1 --mode 1024x768
$ xrandr --output LVDS1 --mode 1024x768 --rate 75
$ xrandr --output LVDS1 --rate 75
$ xrandr --output LVDS1 --auto
Placing outputs in a virtual screen
A bit of configuration for non-KMS setups:
4096x4096
in this example:$ xrandr|head -1
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 4096 x 4096
Virtual
option. With DRI and without
KMS, that might be needed. Indeed, drivers will often create a default
virtual screen with small dimensions, for instance 1600x1200
, to
reduce memory consumption.xorg.conf
by adding a Virtual
line to the
Display
subsection in the Screen
section.Section "Screen"
…
SubSection "Display"
Depth 24
Virtual 3000 2000
EndSubSection
EndSection
Place outputs
--right-of
/--left-of
/--above
/--below
. For instance, to place
the VGA1
output virtually-right of the internal panel (LVDS1
):$ xrandr --output VGA1 --right-of LVDS1
Adding new modes
$ xrandr --addmode VGA1 800x600
$ xrandr --newmode
gtf
or cvt
tools (shipped in
the xserver-xorg-core
package).https://xorg-team.pages.debian.net