xrandr – treat multiple monitors as single screen

Many window managers such as xfce, gnome or kde have graphical utilities to help configure a multi monitor setup. However, almost none if any support configuring multiple monitors as a single screen. In the past technologies such as AMD eyefinity or Nvidia Mosaic enabled these features but they are vendor specific. Problems around Linux compatibility and using closed source drivers aside these technologies are relatively complicated to configure on Linux.

An alternative to these vendor technologies is Xorg TwinView. Unfortunately TwinView requires a convoluted configuration procedure by writing Xorg config files. These configuration files are read during the start up of the graphical environment making it impossible to changes to the monitor setup once the system is running.

None of these clunky solutions are necessary anymore with recent versions of Xrandr. When using Xrandr multiple monitors can be combined into a single so called virtual display. Subsequently these virtual displays can be named and have many of their properties adjusted.

Consider a system having two HDMI devices labeled HDMI-A-0 and HDMI-A-1. These can be combined into one virtual display with the command:

xrandr --setmonitor NameOfDisplay auto HDMI-A-0,HDMI-A-1

The auto parameter will ensure that Xrandr will attempt to automatically combine the monitors into the most logical virtual display. Alternative the geometry can be supplied by using the formula <w>/<mmw>x<h>/<mmh>+<x>+<y> were w and h are the width and height of the virtual display. x and y are the initial positions of the virtual display (displays start in the left top corner) and mmw and mmh are the physical width and height of the monitor in millimeters. All parameters are required and none are optional.

As an additional example consider a multi-monitor setup with 3 displays called HDMI-A-0, DVI-D-0 and DisplayPort-0. Now on HDMI-A-0 a new 4k tv configured for 3840×2160 resolution is connected while on DisplayPort-0 and DVI-D-0 are 1080p displays. Say the two 1080p displays need to display the upper area of the 4k tv side-by-side, how would this be accomplished with xrandr –setmonitor?

xrandr --setmonitor OverlayDisplay 3840/476x2160/268+0+0 HDMI-A-0,DisplayPort-0,DVI-D-0

Leave a Reply

Your email address will not be published. Required fields are marked *

*