XRandR DPI on multihead linux

16,804

Solution 1

I haven't tried it out yet, but there is a good looking answer here which suggests using the xrandr option scale which should get you the effect you're after.

UPDATE: This does work, I've written summary instructions here.

Solution 2

I was able to solve this (with issues) using the details outlined in the following github discussion: https://github.com/linuxmint/Cinnamon/issues/3606

External Monitor QHD (2560X1440), Internal/Laptop Monitor 3200x1800

xrandr --output eDP-1 --scale 1x1 --pos 0x2880
xrandr --output DP-1 --mode 2560x1440 --scale 2x2 --fb 5120x4680

OR External Monitor FHD (1920x1080), Internal/Laptop Monitor 3200x1800

xrandr --output eDP-1 --scale 1x1 --pos 0x2160
xrandr --output DP-1 --mode 1920x1080 --scale 2x2 --fb 3840x3960

These work, but there is a significant amount to tearing in the high resolution monitor (laptop) when I move windows, resize screens or scroll on a browser. This feels like a software rending solution (which has all these issues of tearing, and slow refreshes).

Its 2017, Linux/Gnome needs to address the multi-monitor, mixed scaling solution. Both Windows 10 and OS X have this resolved without having to resort to command line band-aid fixes that partially work (the tearing issue isn't acceptable for gaming)

Solution 3

It is not possible to set different DPI with xrandr.

To handle this situation, there are a number of solutions in various forums and Stack Exchange using scaling (e.g. --scale 2x2 or --scale-from 1920x1440).

While these did work for me, there was a slight blurriness on the up-scaled monitor. It was not very obvious and could be missed easily, but I am very sensitive to such things and it gave me headaches.

A better solution which does not create any blurriness is to use --transform instead of --scale. I have no idea what transform does differently from scaling and the fact that it works is only an empirical observation.

The position of the 2 monitors needs to be set properly: the likes of --left-of, --below, etc. don't work as they don't take into account the transformation.

Here is what I am using, with explanations for each value so that you can adapt it to your situation:

xrandr --output DP-1 --mode 2560x1440 --pos 0x0 --transform 2,0,0,0,2,0,0,0,1 --output eDP-1 --mode 3840x2400 --pos 0x2880 --primary

You can find the name and the proper default resolution for your monitors by running xrandr without arguments.

  • My external monitor (DP-1) has a resolution of 2560x1440
  • I need to transform the resolution by a factor of 2
  • My laptop (eDP-1) has a resolution of 3840x2400

I want to have my external monitor above the laptop. --pos is the position of the top left corner of one monitor in the monitor space (the total area occupied by both monitors).

--pos 0x0 puts the external monitor at the top.

To have the laptop below it, I need to get the proper value for the y coordinate (x will of course be 0 in this case): it is the height of the external monitor (1440) corrected by the transformation (a factor of 2 here), i.e. 1440*2 = 2880.

I am thus using --pos 0x2880 for the laptop.


For reference, this is the system I am using:

  • OS: Arch Linux
  • WM: i3
  • Laptop: 4k
  • External monitor: 1080p

Note: I initially posted a very similar answer on another Stack Exchange here.

Solution 4

you can set different values for each screen with:

xrandr --output <Display1> --dpi X --output <Display2> --dpi Y

To se what are available use just xrandr,to restart the font. I think you could turn off the display and turn it on again with with:

xrandr --output <Display1> --off
xrandr --output <Display1> --auto

but am not really sure

Share:
16,804
Marek Sapota
Author by

Marek Sapota

Updated on September 18, 2022

Comments

  • Marek Sapota
    Marek Sapota almost 2 years

    I have multiple screens with different correct DPI settings. I can use xrandr --dpi X to change DPI for all screens, is it possible to set different DPI for each screen? How do I make apps recalculate font sizes when they are moved to a different screen? xrandr --dpi X only affects new windows, old windows still use the old DPI value.

  • Arnout Engelen
    Arnout Engelen over 10 years
    Ah, actually RandR outputs do have a width/height specified in both pixels and millimeters, so different outputs can have a different DPI - but AFAICS there is no RandR call to manipulate the physical size of the output.
  • Vladimír Čunát
    Vladimír Čunát over 9 years
    Various sources including wiki.archlinux.org/index.php/HiDPI#External_displays suggest that only a single DPI setting is possible at once (in a single Xserver instance). The xrandr command suggested by Agomezl doesn't work.
  • kravemir
    kravemir over 7 years
    Please, always copy-paste instructions to the answers. It's precaution against information loss of historical questions. Sooner or later, most of external links area DEAD, and that would make your answer pointless... Anyway, most of the users would like to see answers on one site, ...
  • Jamie Kitson
    Jamie Kitson over 7 years
    Even if that site is another StackExchange site?
  • Kun
    Kun over 7 years
    The scale command seem to be very GPU intensive when comparing to multi-monitor set-up on Windows 10. Scale means scaling the pixels directly while Windows 10 resizes the text.
  • ARNAB
    ARNAB over 3 years
    While the approach is great, it's missing the DPI setting. One of the Monitors' DPI settings should be set - here it's guesswork - and the scaling worked out from that. Maybe you could annotate this otherwise excellent answer with the DPI value which arewhat lead to the scale factors - not the resolutions.
  • prosoitos
    prosoitos over 3 years
    The DPI can be set through many different ways (Xft.dpi in .Xresources, xrandr --dpi, etc.) and the OP already knows how to set it. The question was about setting different DPIs through xrandr.
  • prosoitos
    prosoitos over 3 years
    Also, with Xorg, it isn't guesswork, it is 96 (see the note at the top of the section here). So setting the DPI for one monitor can be a complex topic and feels to me off-topic for this question.