22

I use the following xrandr command to mirror my 17" laptop with a 27" external monitor, so I can use it to do presentations:

xrandr --output LVDS1 --mode 1600x900 --output HDMI1 --mode 1920x1080 --same-as LVDS1

However, the external monitor (HDMI1) falls back to a 1600x900 resolution instead of 1920x1080.

xrandr output:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
LVDS1 connected primary (normal left inverted right x axis y axis
   1600x900       60.0 +
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   1920x1080      60.0*+
   1680x1050      59.9  
   1280x1024      75.0     60.0  
   1440x900       75.0     59.9  
   1280x960       60.0  
   1152x864       75.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1  
DP1 disconnected (normal left inverted right x axis y axis)
8

If you don't mind panning on laptop try this:

xrandr --output LVDS1 --rate 60 --mode 1920x1080 --fb 1920x1080 --panning 1920x1080* --output HDMI1 --mode 1920x1080 --same-as LVDS1
  • Super great, had no idea this was supported! – blast_hardcheese Dec 2 '15 at 3:11
  • 1
    Seems to be a bug actually getting out of this mode-- xrandr --output $external --primary followed by xrandr --output $internal --primary solved this for me (suggested here) – blast_hardcheese Dec 2 '15 at 20:15
  • 5
    Why is there '*' in the argument for --panning there? The manual does not say anything about it. – jarno Feb 18 '16 at 23:33
  • Thanks for this, this is how I modified the resolutions to work with my UltraWide (21:9) monitor: xrandr --output eDP1 --mode 1920x1080 --fb 2560x1080 --panning 2560x1080--output HDMI2 --mode 2560x1080 --same-as eDP1. This causes some glitches when panning the laptop display, but I don't use it much so it is fine with me. – joelostblom Oct 10 '18 at 16:31
  • After disconnecting the external display, I doxrandr --output eDP1 --mode 1920x1080 --fb 1920x1080 --panning 1920x1080 toget back to normal on my laptop. You can add xrandr --HDMI2 --off before thatif you want to avoid the xrandr warning message. – joelostblom Oct 10 '18 at 16:32
5
xrandr --fb 1920x1080 --output LVDS1 --mode 1600x900 --scale-from 1920x1080 --output HDMI1 --mode 1920x1080 --scale 1x1 --same-as LVDS1

or you could do it another way around to use the resolution of LVDS1 as base resolution, but then you have lower quality on HDMI1.

3

It seems that xrandr is not very good at handling dual monitors in --same-as configuration, when the monitors do not have the same resolution. Appart from falling back to highest common resolution of both monitors (such resolution might not be satisfying or might not even exist), a workaround is to use the --scale option. If you want [monitor 1] with resolution [resx1]x[resy1] and [monitor 2] with resolution [resx2]x[resy2], you can use for instance

xrandr --output [monitor 1] --mode [resx1]x[resy1] --output [monitor 2] --same-as [monitor 1] --scale `echo "[resx1]/[resx2]" | bc -l`x`echo "[resy1]/[resy2]" | bc -l`

where the `echo "[res*1]/[res*2]" | bc -l` compute the desired ratios. Not guaranteeing perfect quality though; moreover, keep in mind that the quality of the resolutions set as above is limited by the resolution of [monitor 1].

2

Setting the resolution is what the xrandr source does if you specify the --same-as relation:

case relation_same_as:
    output->x = relation->x;
    output->y = relation->y;

have you tried:

xrandr --output HDMI1 --mode 1920x1080 --output LSVD1 --mode 1600x900 --same-as HDMI1

?

  • 1
    You've misinterpreted that source quote. The x and y relate to position not resolution. Hence --same-as results in the monitor having the same top left corner position. You certainly can set different resolutions and still use --same-as. – goldilocks Nov 17 '13 at 15:16
2

use the xrandr --scale-from ... option.

xrandr --output LVDS1 --scale-from 1920x1080 will scale down the high resolution image of the external (HDMI1) monitor to the lower resolution LVDS1 laptop monitor.

  • 1
    A note to people with different aspect ratios (such as ultrawide 21:9 and laptop 16:9) is that this will make the laptop screen look compressed horizontally. I also noticed that switching in and out of the --scale-from mode make my screen go black or I can't click anything. The solution for me was to got into another tty (alt+ctrl+F2 for example and then back to the primary tty (F1). However, this did not always work and sometimes I was navigating my screen blindly, so it could be a good idea to try this out when you don't have anything important open and can afford a reboot. – joelostblom Oct 10 '18 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.