Running multiple monitors with different DPI

I look thoroughly and I saw that this kind of question was not solved before in the AskUbuntu community. My problem is pretty simple and am sure a lot of Ubuntu users have it:

  • Simply explained, Ubuntu is not able to run multiple monitors with different resolution, size and dpi.

Having the same size full hd monitors works flawlessly, but I have a laptop that has 4K display and a monitor that has 2560x1080 resolution (21:9) and I cannot use the second monitor because everything is scaled and zoomed. Here are some screenshots of my settings (am using Ubuntu 20.04.1 LTS):

enter image description here

enter image description here

Enabling "Fractional Scaling" does not work as expected - the scaling on the second monitor (2560x1080) is kind of blurry and my PC is lagging, the mouse is blinking and so on. Just for information, I have i7 9750H, 16gb of ram and dedicated gtx 1650 gpu, but it seems that the PC starts to lag a log as soon as I enable "Fractional Scaling".

I found an article that might help me: https://techknowfile.dev/using-a-hidpi-monitor-with-a-low-resolution-external-monitor-ubuntu-i3/ but because I have played with xrandr before and messed up stuff so badly without understanding them I decided to call for help here.

I would be really grateful if you help me solve this problem. This should help many other users as well, having a similar problem.


First off I will say that I am no expert at this and anyone else is welcome to provide insight or correction...

I was able to somewhat duplicate the scenario. I have a laptop-->1920x1080 and a TV-->1280x720

My first "answer" is, I was able to push the TV to 1920x1080i without a lot of extra wizardry involved, so have you tried just moving your 34" LG up to a different resolution?

...but with me using the resolutions that were "auto" selected, this is what worked for me:

xrandr --output eDP --auto --verbose --output HDMI-A-0 --auto --scale 2x2 --panning 2560x1440+1920+0 --right-of eDP

This the part where I can use some input... In the panning, I took my TV H-resolution and subtracted it from the H-resolution of the laptop... and added that to the laptop resoultion:
1920 - 1280 --> 640 + 1920 = 2560 .... and then the same with the V-resolution 1080 - 720 --> 360 + 180 = 1440

This was the only way I could get the scaling to behave properly on the TV, otherwise it would be limited to a small portion of the screen and the rest of the screen was not accessible by the cursor.
I am positive that there is a more elegant way of coming up with this, and I am really don't even think it is fully correct, because when crossing between the screens the bottom of the TV doesn't exactly line up with the bottom of the laptop screen. Exactness is going to take more experimenting.

I ran a Transformers action scene on youtube (on the TV) for a few minutes to see if it would behave... unfortunately I didn't realize my laptop wasn't plugged in and it shut off so I only got about 3-4 minutes of testing...

In your case:
With respect to your hesitation to use xrandr... there are a couple of things you can do...

  1. First grab the current settings and put them in the command line or even a script and call it with a launcher.
    xrandr --current will show your current config.
    You could type out xrandr output eDP-1-1 --auto --verbose --output DP-1-3 --auto --right-of EDP-1-1 and execute it. Nothing should happen, this is your current config... but once you start testing, if you end up screwing up the display you could always "up-arrow" to this command and get back to this config. (A while ago, when I was having a similar problem, out of laziness I made a launcher on the panel and put this command in it... so I would just log in and hit the launcher and fix my screens)
  2. If you find that your screen blows up and you can't move your mouse or get back to your terminal, then CTRL+ALT+F4... log in... sudo init 3 to kill your graphical log in... and then sudo init 5 to start it back up again. I believe it takes you back to the graphical login, if not, then either CTRL+ALT+F1 or CTRL+ALT+F7 will. Log back in and continue testing. I haven't been able to cause any permanent damage with xrandr yet...

You may want to check my math but I think your command will be:

xrandr --output eDP-1-1 --auto --verbose --output DP-1-3 --auto --scale 2x2 --panning 5120x3240+3840+0 --right-of EDP-1-1

If you wanted to use a specific resolution instead of "auto", you would remove --auto and replace it with --mode ####x####(an available resolution)... but if there is multiple of the same resolution (ie 1080pvs1080i) you may want to use the register that it has assigned to it, like --mode 0x254 (be aware these may not be persistent).... refer to your xrandr --verbose output.

Again, I am no expert on this, but you can experiment with those numbers, the same way I did until I found a working set. It seemed that the panning was the key when I added the 2x2 scale.

I have read that scaling doesn't always work well with NVIDIA cards.