webots icon indicating copy to clipboard operation
webots copied to clipboard

Fix high DPI scaling bug on i3 window manager (Linux)

Open omichel opened this issue 3 years ago • 2 comments

This adjusts the Linux launch script to deal with a scaling bug in the i3 window manager and Qt6 on high DPI monitors. The high DPI handling of Qt6 is disabled and the UI is manually scaled.

Scaling issue in simulation UI R2022b https://github.com/cyberbotics/webots/issues/5024

  • [x] A check with non 4k monitor or non high dpi monitor would be interesting

omichel avatar Aug 10 '22 06:08 omichel

I just tested on a non-4K screen and it doesn't look good as the fonts and scaling of the UI (icons, etc.) are too big.

omichel avatar Aug 10 '22 06:08 omichel

I had to adapt the script to test whether we are on a high DPI display so that it doesn't break the GUI on low DPI displays (96 DPI).

omichel avatar Aug 10 '22 07:08 omichel

@TheMangalex: can you confirm that this still works and looks good for you?

omichel avatar Aug 10 '22 10:08 omichel

Sadly not, the script goes completely correct by getting the Xft.dpi value (180 for me, because else the font on this laptop is unreadable), but the section below isn't executed.

I think the problem is in line 77. if [[ "$DPI" > 96 ]]; then I am by no means a bash expert, but it seems like > can't be correctly used in [[ ]] and must be replaced with -gt or double round brackets must be used. So either if [[ "$DPI" -gt 96 ]]; then or if (( "$DPI" > 96 )); then seem to do the trick for me and launch with the correct exports.

FrederikBark avatar Aug 10 '22 13:08 FrederikBark

You are totally right! I am fixing this right now.

omichel avatar Aug 10 '22 13:08 omichel

(180 for me, because else the font on this laptop is unreadable)

That looks odd, wouldn't you get a better performance with a value of 192 instead (as the scale factor should be an int number, e.g., 2)? On my machine, the windows manager explicitly recommends setting it to a multiple of the original DPI, which is 96, to get a better performance.

omichel avatar Aug 10 '22 13:08 omichel

That's actually a good point, I should set it 192. Thanks for the tip.

FrederikBark avatar Aug 10 '22 13:08 FrederikBark