X11 KDE multiple monitors with different resolutions

How to setup an X11 KDE desktop with an HiDPI 4K monitor plus a WUXGA (1920x1200) monitor on a fixed desktop configuration. I’m using the nvidia proprietary driver.

Pick an appropriate DPI for the 4K monitor via: Application Menu -> System Settings -> Appearance -> Fonts. For my 27 inch 4K monitor the following work OK:

  • 144 dpi is a bit smaller than normal, but usable
  • 168 dpi is the actual DPI of a 27 inch monitor - if want normal sized fonts
  • 156 dpi is about right for my eyes.

Configure the Application Menu -> System Settings -> Appearance -> Icons and use the “Configure Icon Sizes” button at bottom (I use 48).

Adjust the Panel height by right mousing on the panel to access “Edit panel…”.

Create /etc/X11/xinit/xinitrc.d/50-xrandr.sh with content similar to the following but modified to suit your configuration:

xrandr --output DP-4 --auto --output DP-0 --auto --scale 1.75x1.75 --right-of DP-4

You can run xrandr with no parameters to find out the names of your monitors. In my case the 4K monitor is DP-4 and the WUXGA monitor is DP-0. The 1.75 scale will compress the 4K specific DPI down to fit the lower resolution WUXGA screen dimensions, pick and appropriate scale factor for your own case. In my case the WUXGA monitor is to the right of the 4K monitor. The need to set the scale is because KDE with X11 does not support monitors with different DPI (Wayland does, but it has other problems). Note that scaling the WUXGA monitor will also cause images to be scaled, I can live with that.

Disable Application Menu → System Settings → Workspace → Startup and Shutdown → Background services → KScreen 2. Kscreen2 manages the dynamic attachment and removal of monitors. Disabling it fixes two issues. Firstly, on login KScreen2 messes with the desktop in a way that conflicts with xrandr scaling settings for the normal (non-4K) monitor. Secondly, KScreen2 moves windows from powered down monitors to ones that re still powered up, I prefer my windows to stay where I put them. If you don’t disable KScreen2, everything will mostly still work, but on login windows may be restored to the wrong position, so if you are using a laptop with hot pluggable monitors, you could leave KScreen2 enable if you need it.

The only issue I’ve had with the above configuration is that if a bug/issue stops the Compositor and I fail to notice, then the screen drawing will be wrong until I realise I need to re enable compositing via: Application Menu → System Settings → Hardware → Display and Monitor → Compostor. Because I’ve been hit by this more that once, I now run a desktop startup job to check if the compositor is running: Application Menu → System Settings → Workspace → Startup and Shutdown → Autostart → check-compositor, where check-compostor is a script with the following content:

#set -x

compositor_enabled=$(qdbus-qt5 org.kde.KWin /Compositor org.kde.kwin.Compositing.active)

if  "$compositor_enabled" != "true" ]
     notify-send -a "Check Compositor" -t 0 -i dialog-error.png 'Hardware -> Display and Monitor -> Compositor is disabled!'

IME it is better to set the correct DPI and adjust font and panel sizes, etc. Different DPI’s cause dithering, specially noticed on text on a graphics screen. On my Philips 27" 4k monitor DPI is set to automatic in system-settings>Fonts and inxi show X monitors set to 157 DPI, not much different from what is right for you

I’ve dabbed with this mixed display setup before I got the second 4K monitor, in particular as related to VirtualBox VM settings both in host and guest settings. More info here https://forums.opensuse.org/showthread.php/533545-UHD-(4K)-WUXGA-monitors-nvidia-blob-Plasma-mismatched-scale-issues in case someone is interested.

Thanks for the additional info. I used DPI numbers from the web. If I actually do the calculations the horizontal DPI for my monitor is 156.3 (LG 27UL650-W). So it looks like I naturally gravitated back to the native DPI.

My original settings were based on what I read at the arch linux wiki. At some point I also found the thread to which you refer. In that thread, Deano Ferrari’s suspicion about KScreen2 was the final piece of the puzzle. Thanks for including a reference to the thread, I’d lost track of it.

I can’t say I ever noticed any dithering issues, perhaps this may depend on the type of display panel and monitor settings. Maybe my eyes may be past the stage where I can perceive the fine detail present in 4K 27".

It’s been a while, but I think that the dithering problem was most noticeable in VMs when the host was not set to the default DPI.