Skip to content

xrandr

Installation

emerge --ask x11-apps/xrandr

Screen manipulation

xrandr -q --verbose \
    | grep -i EDID -A 8 \
    | grep -v EDID  \
    | sed s/\\t//g \
    | edid-decode \
    |grep -i "Man\|Product Name\|Model\|Serial"
Set HDMI-X as primary
xrandr --output HDMI-X --primmary
Rotate HDMI-X to right
xrandr --output HDMI-X --rotate right
RSet the primary display if more than one device is attached:
xrandr --output LVDS-1 --primary
RExtend to an external display attached on a known interface (left-of, right-of, above, below, same-as):
xrandr --output DVI-1 --auto --left-of LVDS-1
Turn off the device:
xrandr --output LVDS-1 --off

Screen modes

A mode always consists of a resolution and a refresh-rate. With a xrandr 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:

xrandr --output LVDS-1 --mode 1024x768
It will use the highest refresh-rate in that mode, to also change the refresh-rate (in Hz):

xrandr --output LVDS-1 --mode 1024x768 --rate 75
The changes apply immediately and on the hardware listed above it might either produce an error or the screen goes blank, because 75Hz 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 (x11-libs/libxcvt) can be used to get a proper modeline
cvt 1024 768 75
Everything after Modeline needs to be appended to the following command:
xrandr --newmode \
    "1024x768_75.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 \
    -hsync +vsync
Sets an output called LVDS to its preferred mode

Its right put an output called VGA to preferred mode of a screen which has been physically rotated clockwise:

xrandr --output LVDS --auto --rotate normal --pos 0x0 --output VGA --auto --rotate left --right-of LVDS
Forces to use a 1024x768 mode on an output called VGA:
xrandr --newmode "1024x768" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
xrandr --addmode VGA 1024x768
xrandr --output VGA --mode 1024x768
Enables panning on a 1600x768 desktop while displaying 1024x768 mode on an output called VGA:
xrandr \
    --fb 1600x768 \
    --output VGA \
    --mode 1024x768 \
    --panning 1600x0
Have one small 1280x800 LVDS screen showing a small version of a huge 3200x2000 desktop, and have a big VGA screen display the surrounding of the mouse at normal size.
xrandr --fb 3200x2000 \
    --output LVDS \
    --scale 2.5x2.5 \
    --output VGA --pos 0x0  \
    --panning 3200x2000+0+0/3200x2000+0+0/64/64/64/64

  • Comments are closed on this article!

Last update: December 4, 2022 19:31:07