Last year, I purchased a new 4K monitor to use as my primary display in addition to my existing 1080p monitor. Like with most 4K monitors, this one required scaling to display text and interface elements in a readable size. While the dual monitor setup worked okay out of the box on Windows 10, it didn’t on my Arch install running an up-to-date KDE Plasma.
1.5x scaling in the Display settings on Plasma made everything look okay on the primary 4K monitor but look large and ugly on the 1080p monitor. I was aware that Wayland supports mixed DPI environments very well but I was stuck on Xorg due to having an Nvidia GPU and Plasma’s support for EGLStreams still being a work in progress.
I read multiple recommendations on the internet to scale (mentioned correctly in a few places as “upscaling”) the 1080p display using
xrandr to compensate for the scaling done by the desktop environment so that everything looks okay on both displays. What confused me a long time is that “scaling” meant different things when it came to
xrandr and the desktop environment. Scaling in the desktop environment translated to zooming in the desktop by 1.5x (“downscaling”) to make everything look larger and (up)scaling the display using
xrandr meant zooming out the Xorg display for the monitor 1.5x to make everything look smaller.
A lot of different
xrandr commands were given as examples. However, all of those were for setups different from mine and used a lot of parameters and flags without a general explanation of what they do and how to adapt them for other scenarios. This was very important for someone like me who isn’t familiar with the terminology. So for a while, I had to resort using just
konsole on the secondary 1080p monitor with the font size reduced to make it look okay and the interface elements still looking large and ugly.
Eventually, I found out the solution that I needed – scale the desktop environment 1.5x which reduced the effective resolution of the 4K (3840×2160) monitor to 1440p (2560×1440) and that of the 1080p (1920×1080) monitor by 1.5x to 720p (1280×720). That made everything on the 4K monitor look properly sized and large on the 1080p monitor. To fix that, I had to use
xrandr to upscale the 1080p display by 1.5x (2880×1620) to compensate for the desktop environment’s 1.5x scaling. With that, everything looked good on both monitors. Below is the
xrandr command that I used.
xrandr --fbmm 6720x3780 --output DP-0 --pos 2880x0 --mode 3840x2160 --scale 1x1 --primary --output HDMI-0 --pos 0x0 --mode 1920x1080 --scale 1.5x1.5
fbmm flag sets the reported physical size of the X screen as a whole. In this case it is
(3840+2880)x(2160+1620), which is the sum of the resolutions of both monitors after running the
xrandr command. The
--pos flag is used to position the monitors in the
6720x3780 display. Since the 1080p monitor is present to the left of the primary 4K monitor, its position is at
0x0. The starting position of the 4K monitor is
2880 is the horizontal resolution of the 1080p monitor, so that it is positioned right after the latter ends.
This still caused an issue on the 1080p monitor where the Plasma desktop screen was reduced in size by 1.5x and was not filling the whole display. This also meant that the wallpaper was not filling the whole display. The unfilled area in that display was black in color. (Update May 2020: this can be fixed by restarting the Plasma Shell) To work around this issue, I used black color as the wallpaper for that screen and removed all the elements on that desktop. Till very recently, I continued using black color as the wallpaper and when I found that this was fixed in a recent Plasma update (not sure when and which version), I was able to use a proper wallpaper on the 1080p monitor as well.
While this solved the major problem with mixed DPIs, the GUI toolkits (Qt 5, GTK 3) and some applications like Firefox needed some additional scaling tweaks to get them looking okay. For this I used the excellent documentation on HiDPI in the Arch wiki which covered almost everything. Steam and VirtualBox were a couple of notable exceptions that didn’t work okay. The former didn’t support fractional scaling and only worked with 2x scaling which makes everything noticeably larger. The latter was broken and had a lot of issues with the menus appearing in the wrong places and the guest VMs unable to use a proper resolution. Fixing this issue required setting