Is it possible to have different DPI configurations for two different screens?

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

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.


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)


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

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.