1. Overview

In this tutorial, we’ll learn how to mirror dual monitors with different resolutions from the Linux command line.

2. Mirroring Dual Monitors With Different Resolutions

To mirror dual monitors with different resolutions, we’ll use the xrandr command.

Let’s begin by running xrandr without any arguments:

$ xrandr
DP-1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 430mm x 270mm
   1680x1050     59.88*+ 60.32    56.25  
   840x525       60.01    59.88  
DVI-D-1 connected primary 1920x1080+1680+0 (normal left inverted right x axis y axis) 476mm x 268mm
   1920x1080     60.00*+  59.96    59.93  
   1680x1050     59.95    59.88  

If we run xrandr without any arguments, it prints information about the various outputs connected to our computer.

The information we need is the name of the outputs (DP-1DVI-D-1) and their associated resolutions (1680×1050, 1920×1080).

Now that we have the names of the outputs, let’s use xrandr to mirror them:

$ xrandr --output DVI-D-1 --same-as DP-1

In this example, we use xrandr –output to get the output we want to modify (DVI-D-1). Then, we use the –same-as option to specify that output to mirror (DP-1).

However, since our resolutions are different, there will be extra space on our larger monitor that is unused.

If we don’t want any extra space when mirroring our displays, we’ll need to scale the smaller display to match the larger one. Let’s do this using xrandr –fb:

$ xrandr --fb 1920x1080 --output DP-1 --mode 1680x1050 --scale-from 1920x1080 --output DVI-D-1 --mode 1920x1080 --scale 1x1 --same-as DP-1

Here, we use xrandr –fb to specify the resolution of the space we want to create (1920×1080). This should be the resolution of the large monitor. We then specify the outputs we want to display this space on using –output.

We first specify the smaller output DP-1 and the resolution we want to use with –mode. Next, we use –scale-from to scale the output from the right resolution (1920×1080). We do the same thing with the larger resolution output (DVI-D-1). But, since it’s the same resolution as the space we created using –fb, we can just specify the scale as 1×1.

After we run this command, we should see our DP-1 and DVI-D-1 monitors mirrored, with the smaller resolution monitor (DP-1) being stretched to scale to the higher resolution.

3. Conclusion

In this article, we learned how to mirror dual monitors with different resolutions in two ways.

One way keeps the scale of each monitor but causes the larger resolution monitor to have unused space. The other way uses scaling to make the smaller resolution monitor fit the larger resolution, ensuring no unused space, but having a stretched image.

Comments are closed on this article!