179

I'm using Ubuntu 12.04.3 with NVidia drivers (319) for my Quadro K2100M graphic card, and when I switch my main 3200x1800 laptop screen to mode 1920x1080 (using nvidia-settings), the display goes blurry...

I am using two screens:

  • My main screen is a LCD with max resolution 1920x1200.
  • My laptop screen (original resolution 3200x1800) is sitting to the right of that.

The main problem is that, on Ubuntu, the font is far too small on my laptop screen. Because of that, I wanted to change the resolution of my laptop to 1920x1080.

Reading Galgalesh's answer, I tried to compute my DPI and here is the DPI configuration which I should have:

  • 94x94 for my main LCD screen 1920x1200
  • 235x236 for my 3200x1800 laptop screen

Is there a way to have dual DPI resolutions with an extended desktop?

Zanna
  • 72,312
Anthony O.
  • 2,559

12 Answers12

156

It seems people are still struggling trying to work with several monitors and HiDPI displays. A good workaround is described in arch wiki https://wiki.archlinux.org/index.php/HiDPI#Multiple_displays. So, I have:

  • laptop asus ln303ux: 3200x1800,
  • external monitor: 1920x1200

Now I use Ubuntu 14.10 & GNOME Shell 3.12.2 that has pretty usable HiDPI support. So I just use out-of-the-box support of HiDPI - scaling factor is 2 (it can be set up via GUI). That means that on external monitor I get everything twice bigger than acceptable. Thus, I use xrandr; but instead of downscaling laptop screen, I upscale external monitor screen:

xrandr --output HDMI1 --scale 2x2 --mode 1920x1200 --fb 3840x4200 --pos 0x0
xrandr --output eDP1 --scale 1x1 --pos 320x2400

So, one by one:

  1. --output HDMI1 in my case is the external screen, eDP1 is the laptop screen.
  2. --scale 2x2 - make everything on external screen twice smaller
  3. --mode XxY - explicitly set the resolution for screen (not necessary if is already set)
  4. --fb XxY - set size of a virtual screen (framebuffer) (important without this, you will be able to use only a fourth part of the screen). In my case one screen was on top of another, so I added up effective heights 2400+1800=4200. Also note, that maximum framebuffer size might be specified in xorg.conf - then you cannot exceed it (it is written in the first line of xrandr -q output).
  5. --pos XxY - in my case I set absolute positioning of the screens, so my laptop screen is directly on the bottom of the external screen. The value Y here is double the external monitor height.

And this is it! Everything is as crisp as it could be.

FYI: to get the names of the screens and available resolutions, one can run xrandr --current. More information on setting the resolution an be found here: https://wiki.ubuntu.com/X/Config/Resolution .

UPDATE - OPTION 2: one more interesting workaround for applications that support GTK3. If I normally use only one application on the large screen (e.g. some IDE, like leksah), I do not resize the the screen, but run the application scaled to its original size

env GDK_SCALE=0.5 GDK_DPI_SCALE=0.5 CLUTTER_SCALE=0.5 appname
artem
  • 1,631
26

On Ubuntu 20.04, for me clicking Fractional Scaling option in the bottom of display settings resolved everything. This will allow to scale each monitor separately.

Marcel Braasch
  • 361
  • 3
  • 5
9

I used artmem's solution but ran into the mouse problem mentioned by EoghanM. The workaround I found in the old bug report he linked to related to --panning.

I'm shooting for: - DP1-2 3840x2160 in native DIP. - eDP1 1366x768, scaled to look reasonable to the right of DP1-2.

I get this to happen by having a frame buffer that is like DP1-2 + (2x eDP1) then I scale everything going to eDP1 by 1/2.

This should be simple but xrandr is a bit tricky.

Here --scale is used to reduce everything going to eDP1 by 1/2. --panning is the same as eDP1 in the original frame buffer with the position (+3840+0) of just to the right of DP1-2. +0+2160 would be below it.

xrandr -d :0 --fb 6572x3696 --output DP1-2 --mode 3840x2160 --scale 1x1 --rate 60 --pos 0x0 --primary

# sometimes panning get applied incorrectly when switching from some other mode, running it twice is a work around
xrandr -d :0 --output eDP1 --off
xrandr -d :0 --fb 6572x3696 --output eDP1  --mode 1366x768  --scale 2x2 --panning 2732x1536+3840+0
xrandr -d :0 --fb 6572x3696 --output eDP1  --mode 1366x768  --scale 2x2 --panning 2732x1536+3840+0

I also set Xft.dpi to 185

$ cat ~/.Xresources
Xft.dpi: 185

When I unplug from the external monitor I run :

xrandr -d :0 --output DP1-2 --off
xrandr -d :0 --fb 2732x1536 --output eDP1  --mode 1366x768  --scale 2x2 --panning 2732x1536+0+0 --pos 0x0 --primary

That doesn't look great but I'm not away from my desk much. You could get around this by changing Xft.dpi and restarting all your desktop programs. I don't know of a way to change Xft.dpi and then get clients to use it without restarting them.

Brian C.
  • 216
8

These answers are all great, and helped me previously, but a recent

sudo apt-get upgrade 

deleted my randr-config! In attempting to restore my settings I found I could no longer get the mouse beyond the top 1/4th quadrant of the second screen, no matter the --fb input. From https://wiki.archlinux.org/index.php/HiDPI#Side_display I eventually discovered that adding panning did the trick. Also, use of '--right-of' or '--left-of' is simpler than '--pos'.

"Generically if your HiDPI monitor (laptop) is AxB pixels and your regular monitor (external) is CxD and you are scaling by [ExF], the commandline for right-of is:"

xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning [C*E]x[D*F]+[A]+0 --scale [E]x[F] --right-of eDP-1
ONECore
  • 81
8

Why is it blurry?

Your screen always displays 3200x1800 pixels. If you lower the screen resolution on your computer that just means that your screen has to scale the image to fit your screen. Depending on the ratio between your native resolution and the current resolution, that scaling will produce a blurry image.

You can find more information on scaling and native resolution here: https://en.wikipedia.org/wiki/Native_resolution

How can I make the text bigger?

If the text is too small you have two options:

1. Change Ubuntu's font size

How do I change fonts and adjust their size?

2. Change DPI (will make the whole interface bigger, not only text)

How to find and change the screen DPI? (answer by @whtyger)

5

I had a similar problem and solved it this way.

I have an external big screen 24" 3840x2160 and a laptop same definition 3840x2160 but small screen 15.4"

I wanted the laptop screen to be zoomed because default scaling is too small ..

Scaling down with xrandr as we usually see results in blurry screen, the solution is to scale everything up with xrandr then use gnome scaling factor :

Here is how to do it (external screen on top of laptop screen but you can arrange in a different way if you change pos parameters)

xrandr \
    --output DP-0 --primary --mode 3840x2160  --pos 0x0 --scale 2x2  --rotate normal \
    --output DP-2 --mode 3840x2160 --pos 0x4320 --scale 1x1  --rotate normal \
    --output DP-1 --off

Explanations :

--output : DP-1 is the external screen, DP-2 is the laptop screen (use xrandr -q to get your devices names)
--mode : both screen have same definitions 3840x2160
--scale 2x2 for external, 1x1 for laptop, this is "relative" to the primary which is external screen here..
--pos : external screen is at position 0x0, laptop screen is bellow at pos 0x(2160*2)=0x4320 because external screen is scalled by 2

Then

gsettings set org.gnome.desktop.interface scaling-factor 2

OR

gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <2>}"

enter image description here

karel
  • 122,292
  • 133
  • 301
  • 332
phico
  • 71
4

I spend hours to solve this issue. I have a 4k laptop and 1080p external monitor. If I set scaling to "200%" external monitors displays enlarged icons text etc.

I tried xrandr commands with "--scale" but they didnt give me the expected results. So I have a xrandr command that works perfectly for me. I wish somebody else find it helpful.

xrandr --output HDMI-1-1 --mode 1920x1080 --pos 0x0    --rate 60.00 \
       --transform 2,0,0,0,2,0,0,0,1 \
       --output eDP-1-1  --mode 3840x2160 --pos 0x2160 --rate 60.00 --primary

This commands works as external monitor scaled to "100%" and built-in screen scaled to "200%". This commands places external monitor above the built-in. Keep in mind you probably will change --output names with yours.

Note that 2160 in --pos 0x2160 has nothing to do with the height of eDP-1-1 (it just happens by chance to be the same value in my case). That number is in fact the height of the upper monitor (1080 in my case) corrected by the transformation (so 1080*2 in my case).

This is because --pos refers to the position of the upper left corner in the virtual screen space, so the bottom screen has to be positioned relative to the height of the upper screen.

Finally, you can ignore --rate flags. The most important flag here is --transform. And positions depends on screen resolutions and placements. Using this commands I have a Arandr preview like this;

Arandr screenshot

1080p monitor is virtually adjusted to take up twice as much space. Thanks to monitors are perfectly aligned, when I move the mouse from one screen to another, it appears on same horizontal coordinate

Bruno Bronosky
  • 939
  • 11
  • 14
yalcinozer
  • 161
  • 5
4

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)

Jeets
  • 68
  • 8
2

I have an outdated 1024x768 monitor, connected to a (less outdated) notebook.
The windows rendered in quite different sizes, much bigger in the external monitor (which has an older, bigger dot pitch).
I found a command to scale the monitor:

xrandr --output VGA-1 --scale 1.5x1.5

VGA-1 is the internal name of the monitor, found by running the following command:

xrandr --current | grep connected

The effect is that now the old monitor displays its contents at almost the same size as the notebook.

Curiously enough, it works scaling x1.5 but not 1.45, the display (in my case) turns black.

When I ran the scale comment the first time the result was frightening because the contents of both screens overlapped. For example the cursor pointer appeared twice.

I ran a program:

arandr &

to set the relative screen positions to fix it.
It works like the Settings > Devices > Displays setting.

I installed it with:

sudo apt-get install arandr

Thanks @LuisAlvarado and others for sharing your knowledge!

Zanna
  • 72,312
Juan Lanus
  • 201
  • 2
  • 6
2

Fist run $xrandr to display all outputs

Screen 0: minimum 320 x 200, current 7680 x 2160, maximum 8192 x 8192
eDP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   3840x2160     60.00*+  59.98    59.97  
   3200x1800     59.96    59.94  
   2880x1620     59.96    59.97   
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 connected 3840x2160+3840+0 (normal left inverted right x axis y axis) 521mm x 294mm
   1920x1080     60.00*+  50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1280x1024     75.02    60.02

As you can see in this case the second monitor is connected to DP-3 Then you can resale the display: $xrandr --output DP-3 --auto --scale 2x2

Kevin Bowen
  • 20,055
  • 57
  • 82
  • 84
Abdelhak
  • 21
  • 1
1

I made a script to automatize the calculation in artem's anwser:

#!/usr/bin/env bash

# usage:
# ./script.sh 8 # to set scale 1.8

Y1=1440
X2=1680
Y2=1050

xrandr --output HDMI2 --scale 1.$1x1.$1 --fb $(($X2 * 1$1 / 10))x$(($Y1 + $Y2 * 1$1 / 10)) --pos 0x0
xrandr --output eDP1 --scale 1x1 --pos 0x$(($Y2 * 1$1 / 10))

It's ugly, because bash doesn't support operations on floats, but it works.

0

I tried all of the above and nothing seems to work flawless. In the end I just put two terminal entries into my Fluxbox menu. One for the high res display and one for the low res.

[exec] (Terminal 9pt) { xterm -fa Hack:size=9 } <>
[exec] (Terminal 12pt) { xterm -fa Hack:size=12 } <>
ceving
  • 351