Generated by GPT-5-mini| xrandr | |
|---|---|
| Name | xrandr |
| Developer | X.Org Foundation |
| Released | 2004 |
| Operating system | Unix-like |
| Genre | Display server utility |
| License | MIT License |
xrandr is a command-line utility for the X Window System that dynamically configures display settings such as screen resolution, rotation, reflection, and multiple-monitor layout. It interacts with the X.org Server and the RandR extension to query and set screen modes, enabling runtime changes without restarting the session. xrandr is commonly used in conjunction with desktop environments like GNOME, KDE, and window managers such as i3 and Xmonad.
xrandr operates as a frontend to the X Resize, Rotate and Reflect (RandR) extension of the X.Org Server, exposing capabilities of graphics drivers from vendors such as Intel, NVIDIA, and AMD. It reads mode information provided by the kernel framebuffer, DRM, and KMS subsystems, and negotiates settings with device-specific backends like xf86-video-intel, nouveau, and amdgpu. Historically, RandR superseded older mechanisms like multihead setups managed by xinerama and static configuration via XF86Config or xorg.conf. xrandr is distributed with the x11-xserver-utils package in many distributions such as Debian, Ubuntu, Fedora, and Arch Linux.
The basic invocation prints current outputs and modes, while flags modify behavior; typical calls are executed in shell environments like Bash, Zsh, or Fish. System integrators embed xrandr calls in session startup scripts for display arrangement in GNOME Shell, KDE Plasma, XFCE, LXDE, and tiling managers including i3, Sway (via equivalent Wayland tools), and dwm. Administrators often use xrandr in conjunction with utilities like xrandr --output wrapped by systemd user units, cron, or hotkey daemons such as sxhkd and autokey. For multi-seat deployments or remote sessions using X11 forwarding from OpenSSH, xrandr behavior depends on the capabilities exposed by the remote X server.
xrandr exposes a set of options (e.g., --output, --mode, --rate, --rotate, --left-of, --right-of, --primary) that operate on named outputs such as DP-1, HDMI-0, VGA-1, and eDP-1. Outputs correspond to connectors on graphics hardware from vendors like Intel, NVIDIA, and AMD. Modes are represented as resolutions and refresh rates negotiated with monitor EDID information, which may be parsed from EDID provided by devices from manufacturers like Dell, Samsung, and LG. xrandr reports current framebuffer size, virtual screen dimensions, and transformation matrices used for rotation and reflection (normal, left, right, inverted). It can also add user-defined modes via cvt or gtf utilities derived from standards bodies such as the VESA.
Common tasks include enabling a second monitor, changing resolution, rotating a display for portrait orientation, or mirroring displays for presentations. For scripted workflows used by administrators of Ubuntu, Fedora, or Debian systems, xrandr commands are embedded in desktop autostart files to support docking stations from vendors like Lenovo and HP. Power users combine xrandr with xinput to map touchscreens, with compositor settings in Compton or Picom for proper VSync, and with xrandr --save/--restore patterns implemented through session managers like LightDM or GDM. In repair or testing scenarios, technicians reference interactions between xrandr, kernel modules such as i915, and firmware from Coreboot or vendor-provided firmware.
xrandr is implemented in C and linked against libraries provided by the X.Org Project including libXrandr and libX11. It communicates over the X protocol to the X.org Server using the RandR extension to query outputs, CRTCs, encoders, and modes exposed by the server and underlying DRM drivers. The architecture relies on coordination among components: kernel DRM/KMS, Mesa 3D drivers like Mesa where applicable, and hardware-specific drivers such as xf86-video-ati or xf86-video-nouveau. The utility interprets EDID data and constructs modelines when necessary, occasionally invoking helpers like cvt or gtf to compute timing parameters following VESA standards.
xrandr cannot reconfigure displays when the X server or driver lacks RandR support, or when running under compositors that do not forward RandR changes, as seen with some Wayland-native compositors where Wayland protocol replaces RandR. Issues often arise from proprietary drivers from NVIDIA where X configuration may be handled by nvidia-settings instead. Common troubleshooting steps involve checking X.org logs such as /var/log/Xorg.0.log, verifying kernel modules like i915 or amdgpu are loaded, and ensuring EDID is correctly read from monitors by utilities like parse-edid. Limitations include inability to manage display settings outside the X server context, inconsistent output naming across kernels and driver versions, and lack of atomic transactions on older RandR protocol versions; remedies include upgrading the X.org Server, switching to modern DRM/KMS stacks, or using compositor-specific tools in Wayland environments.