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:
#!/bin/bash
#set -x
compositor_enabled=$(qdbus-qt5 org.kde.KWin /Compositor org.kde.kwin.Compositing.active)
if "$compositor_enabled" != "true" ]
then
notify-send -a "Check Compositor" -t 0 -i dialog-error.png 'Hardware -> Display and Monitor -> Compositor is disabled!'
fi