Bug 436223

Summary: Krunner incorrectly sets "GDK_SCALE" and "GDK_DPI_SCALE" under wayland and HiDPI
Product: [Plasma] krunner Reporter: Xu Zhao <i>
Component: generalAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: fabian, kde, nate, plasma-bugs
Priority: NOR Keywords: wayland-only
Version: 5.21.4   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Result of incorrect scaling

Description Xu Zhao 2021-04-26 16:08:35 UTC
SUMMARY

Krunner doesn't scale correctly for Firefox and other GTK applications.
Qt applications work well.

I am using KDE with Wayland, 4K resolution with 2x scale factor.
The application scales correctly when started from commandline or plasma application launcher, but it starts with incorrect scale with krunner.

STEPS TO REPRODUCE
1. Start krunner and type "firefox"
2. Start firefox
3. The result application window text looks small (doesn't scale correctly)

OBSERVED RESULT
The result application window text looks small (doesn't scale correctly)

EXPECTED RESULT
The result application window should scale correctly.


SOFTWARE/OS VERSIONS
openSUSE Tumbleweed 20210423
Linux: 5.11.15
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

Inspecting into the process's environment variable, I find "GDK_SCALE=2" and "GDK_DPI_SCALE=0.5", which leads to incorrect scaling.

The process UI scale correctly if started from commandline or from Plasma Application Launcher. And it doesnot have the above two environment variables set when I start it from there.

Therefore, it must be krunner incorrectly set the above two environment variables somewhere.
Comment 1 Xu Zhao 2021-04-26 16:21:06 UTC
Created attachment 137931 [details]
Result of incorrect scaling
Comment 2 Xu Zhao 2021-04-26 16:30:13 UTC
This is because when I start my computer, I first login X11 session.
After I logout X session and login Wayland session, this bug will appear, because in the wayland session, krunner still uses startplasma-x11.cpp to start an application (not startplasma-wayland.cpp).
Comment 3 Fabian Vogt 2021-04-27 20:06:14 UTC
My guess is that GDK_SCALE and GDK_DPI_SCALE are "inherited" from the previous session's systemd launch environment. It probably needs to be added to the exclusion list added in https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/580 as well.
Comment 4 David Edmundson 2021-11-18 01:49:20 UTC
We now reset this var explicitly, please reopen it's an issue on Plasma 5.23 or newer