webots
webots copied to clipboard
Fix high DPI scaling bug on i3 window manager (Linux)
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
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.
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).
@TheMangalex: can you confirm that this still works and looks good for you?
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.
You are totally right! I am fixing this right now.
(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.
That's actually a good point, I should set it 192. Thanks for the tip.