Display scaling from the command line

Hi

I was wondering what utility the KDE Settings
Display and Monitor > Display Configuration > Global scale
option uses under the Hood and how to replicate that on the command line.

Issue

I have a 14" laptop with a 2560x1600 resolution. That thing is basically unusable without some sort of display scaling, it’s way too small. I have a docking station that I switch to frequently and the resultion on the displays works best without any scaling.

Now the Display and Monitor > Display Configuration > Global scale option does not seem to be affected by the For only this specific display arrangement checkbox below it (see this post). Unpluggin or plugging in the dock will not revert to the last used Global Scale settings for the specific display setup but will just leave you with the display sclaing that is set.

Findings

Some people seem to be proposing using xrandr, e.g. xrandr --scalei 1.3x1.3. I’ve only seen this used to scale a display down (make display bigger by making things on the display smaller) but not the other way around, e.g. xrandr --scale 0.8x0.8. If I use that last command, the display changes to a useful “size” but everyting looks a lot less sharp, if you look closely actually pretty blurry.

If I use the Display and Monitor > Display Configuration > Global scale option, the scaling is perfect without any loss of sharpness. But it’s pretty cumbersome to change the scaling setting from the GUI everytime I un/plug my laptop to/from the dock and then restarting or logging out and back in for the changes to actually take effect.

I’d be fine’ish with using a script to change the scaling, that’s why I’m asking if it is possible to achieve from the command line what the Global scale option does. And if there is way to avoid restarting or loggin out and back in.

(I guess this is kind of the easy case when a single global scale works for all attached monitors. 'm already dreading the day when I’ll have to try and get individual scalings per monitor on a different setup…)

Any help is appreciated!

Cheers.