Ondrovo.com

Xorg 4K Hell

So I got a new 4K monitor and wanted to use it with Linux.

Easy enough under KDE, just set the scale factor, fiddle with font sizes a bit, and it just works. However, try adding a secondary monitor with different DPI and you’re in a world of weird hacks.

After some experimentation, I came up with the following script:

#!/bin/bash


sleep 5

xrandr --output HDMI-1 --off

xrandr --output HDMI-1 --auto --scale 1.55x1.55 --right-of DP-2 --rotate left \
    --output DP-2 --scale 0.9999x0.9999

I run the script from KDE autostart (Settings -> Startup and Shutdown). The sleep is needed, it wouldn’t work without the delay; it might be shortened though.

I hope to find a less awkward solution, but it’s good enough for now.