RandR and the tool xrandr are used to manage screen resolutions, rotation and screens with multiply displays in X. With version 1.4 support for multiply graphics cards was introduced, future versions (>1.5) will also support monitors attached via USB (this will probably be merged with xorg-server 1.13 with support for DisplayLink, hotplug-displaylink).
You can install x11-apps/xrandr with the following command:
A common way to execute X related scripts is the use of ~/.xinitrc or ~/.xprofile. Just put the line of code for xrandr in one of these files and it will be executed on every X startup to make settings permanent.
xrandr uses the monitors EDID to identify its capabilities. Some graphic drivers like the binary Nvidia or AMD, do not support xrandr. Also faulty hardware might report wrong or bad EDIDs, in those cases it is still possible to use custom made setups by trial and error.
Running xrandr without any arguments will show attached monitors and its capabilities:
A list of different types for connectors and the naming scheme for RandR:
- LVDS - Laptop Screen
- HDMI - High-Definition Multimedia Interface
- DVI - Digital Visual Interface
- DP - DisplayPort
- VGA - Video Graphics Array
- TV - Composite Video
- S-video - S-Video
A mode always consists of a resolution and a refresh-rate. With a query the hardware reports which modes are supported. It is possible to define own modes in case the hardware reports wrong information. To change the mode for an attached device:
It will use the highest refresh-rate in that mode, to also change the refresh-rate (in kHz):
The changes apply immediately and on the hardware listed above it might either produce an error or the screen goes blank, because 75kHz is not supported. This will last until the next session, using Ctrl+Alt+Backspace will terminate the session and restart X in case something goes wrong. To add a 75Hz mode, the tool cvt can be used to get a proper modeline:
Everything after Modeline needs to be appended to the following command:
Running the query again should list our new added mode.
Some common tasks using xrandr:
- Extend to an external monitor (left-of, right-of, above, below, same-as):
- Set the primary display if more than one is attached:
- Rotate a display (normal, left, right, inverted):
- Turn off the monitor
There are several GUI tools to use xrandr, here is a list of tools supported in Gentoo:
- x11-misc/arandr - independent GUI tool
- kde-base/kephal - KDE Desktop tool
- lxde-base/lxrandr - LXDE Desktop tool