You are not logged in.

#1 2021-10-10 10:17:02

Registered: 2013-01-21
Posts: 29

Scaling factor after switching to external HiDPI display and back

There is a pretty good wiki article about configurations for work with HiDPI displays. Things described there work well if you have one permanent HiDPI display.
But situation is different if you have a laptop with FullHD (1920x1080) native resolution and connect it to external 4k (3840x2160) display from time to time (let's assume 50/50 time split between laptop own screen and external).

All UI elements become too small when you connect 4k display and you need to use x2 scaling factor in your window manager (I'm XFCE user). But this isn't an only thing - many Qt and Gtk application follow their own strategy and you may change their behavior with environment variables. So, you need to reboot your PC to make it effective. Fine - you tuned your system and everything looks nice on 4k. But then... it's a laptop - you disconnect external display and want to use laptop sreen. And... everything is huge now due to x2 scaling factor. And you need to reboot your PC in order to get everything back to normal size.

Logically it seems feasible to create two separate boot configuations and use each them separately with external and interal displays. But it isn't good to reboot the system just because you connected/disconnected display. Probably restart of X-server might be a lighter option but again it will terminate all GUI applications, right? I'm not so experienced with GUI and now struggling to search a way how to change scaling factor (but not only it - also other environment variables as described in wiki) on the fly, probably by some script.
Just for comparison - on Windows it's enough to change only scaling factor (without environment variables) and it's possible to do it with one mouse click - so not a problem to toggle scaling factor when switching between two displays.

So, I'm open to ideas how to make a script for fast switching between 1920x1080 and 3840x2160 resolutions that won't require a restart and will work for any program.


Another option that looked like a workaround - set external 4k (3840x2160) display to FullHD 1920x1080 resolution. I expected it to work nice as scale factor is 2.0 and there should be a mapping of 1 pixel to 2x2 square without any interpolation. But reality is cruel - it appears that monitor itself (I'm not 100% sure but it looks this way) does some kind of upscaling and image is really blurry, not sharp. I played with own display configuation and found only one relevant thing - "Display/Sharpness" - it appears to be reasponsible for this trick and I may change it from 0 to 100 (default is 50). Blur increases indeed if I move slider to 0 and almost disappear when it is at 100. Actually I may say it disappears completely - everything is sharp besides some letters with straight vertical lines, like "I". It is very visible that each of such letter has a green or blue 1-2 pixel shadow. I played with font anti-aliasing settings but was not able to get rid of such shadows and they are really annoying. Thus, 1920x1080 resolution is useless on external 4k display sad despite of simple logic that it should look good with clear x2.0 scaling.
I don't belive that I'll be able to tune 1920x1080 on 4k - it appears to be a generic problem of non-native resolution and some stupid "image enhancement" inside display makes this resolution useless. But if someone has an idea how to get read of any interpolation or image enhancement with simple mapping of 1 pixel to 2x2 square - you are welcome.

Last edited by FuzzySPb (2021-10-10 10:19:40)


Board footer

Powered by FluxBB