Suddenly Seeing Random KDE Programs Scale And Become Huge While Others Do Not When Launched Outside Of KDE Plasma? This Variable Can Save The Day
Recent KDE framework versions combined with Qt 5.14+ will randomly up-scale some KDE programs while other programs remain the same sane sizes they've always been when KDE programs are used outside of the KDE Plasma desktop. This unfortunate issue affects users of desktop environments like Xfce, IceWM and LXQt on several distributions including OpenSUSE and Fedora. Adding
export QT_AUTO_SCREEN_SCALE_FACTOR=0 to
$HOME/.bash_profile or another file read when the desktop session is launched can save the day.
The KDE team has been working hard on adding proper high resolution monitor support to KDE Plasma and programs built on the KDE Framework the past year. They messed up along the way. The result is that some KDE programs, and it is almost random which, become HUGE while others have the same sane sizes they always had, when KDE programs are launched outside the KDE Plasma desktop environment. This affects anyone using KDE software under Xfce, fluxbox, LXQt and foot desktop.
QT_AUTO_SCREEN_SCALE_FACTOR variable is described in the Qt documentation as:
"QT_AUTO_SCREEN_SCALE_FACTOR [boolean] enables automatic scaling, based on the monitor's pixel density. This won't change the size of point-sized fonts, since point is a physical measurement unit. Multiple screens may get different scale factors."
Same program, different font and icon sizes: Some KDE programs will get randomly up-scaled when they are launched outside the KDE Plasma desktop environment while others are not. kwrite is among the programs that are upscaled (right) by default. The old default size (left) is what you get if you demand that scaling is turned off using a variable.
Some program using the KDE Frameworks version 5.70 and 5.71 linked to Qt 5.14 and 5.15 will act as if
QT_AUTO_SCREEN_SCALE_FACTOR is set to 0 while others act as if it is set to 1 if it is unset and those programs are launched outside of the KDE Plasma desktop. kwrite and kate and many others will act as if
QT_AUTO_SCREEN_SCALE_FACTOR=1 while others, like kcalc and kdenlive, act as if
QT_AUTO_SCREEN_SCALE_FACTOR=0. The result is that two KDE programs launched under IceWM or fluxbox have wildly different font sizes, menu sizes and so on. One could be gigantic and while other is not.
A simple solution to this mess is to add
QT_AUTO_SCREEN_SCALE_FACTOR=0 (or =1 if you want that kind of scaling) to a file such as
$HOME/.bash_profile - preferably within something that checks if a desktop environment other than KDE is launched:
if [ ! "$XDG_CURRENT_DESKTOP" == "KDE" ];then export QT_AUTO_SCREEN_SCALE_FACTOR=0 fi
QT_AUTO_SCREEN_SCALE_FACTOR was deprecated as of Qt 5.14 so it is interesting that Qt 5.14 is the first Qt version where that variable has to be set in order to prevent random KDE programs to up-scale to ridiculous sizes.
It is generally unfortunate that the Linux desktop ecosystem is trending towards GNOME "apps" being broken outside of GNOME and KDE programs being broken outside of KDE Plasma. Manually setting
QT_AUTO_SCREEN_SCALE_FACTOR is, for now, a usable work-around for those KDE programs that recently became unusable outside of KDE Plasma.