Bug 469273 - Should we not enforce the environment of QT_AUTO_SCREEN_SCALE_FACTOR under wayland?
Summary: Should we not enforce the environment of QT_AUTO_SCREEN_SCALE_FACTOR under wa...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Startup process (other bugs)
Version First Reported In: 5.27.4
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-02 15:32 UTC by ihipop
Modified: 2025-04-18 13:49 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.4.0
Sentry Crash Report:


Attachments
virtualbox with QT_AUTO_SCREEN_SCALE_FACTOR=0 looks like this very ugly (239.32 KB, image/png)
2023-05-02 15:32 UTC, ihipop
Details
virtualbox with QT_AUTO_SCREEN_SCALE_FACTOR=1 , just looks well as windows/X11 (429.33 KB, image/png)
2023-05-02 15:34 UTC, ihipop
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ihipop 2023-05-02 15:32:38 UTC
Created attachment 158625 [details]
virtualbox with QT_AUTO_SCREEN_SCALE_FACTOR=0 looks like this very ugly

When it comes to the X11 we will make sure that:
-  [`QT_AUTO_SCREEN_SCALE_FACTOR` is set to `0`](https://invent.kde.org/plasma/plasma-workspace/-/blob/21cefd1083144e7bc51c6c9b46448a22b0a607f2/startkde/startplasma.cpp#L330)
-  [set up a list of `QT_SCREEN_SCALE_FACTORS` to list every screen's scale factor](https://invent.kde.org/plasma/plasma-workspace/-/blob/21cefd1083144e7bc51c6c9b46448a22b0a607f2/startkde/startplasma-x11.cpp#L52)

When it comes to the Wayland, the `QT_SCREEN_SCALE_FACTORS` is missing,because we don't need this,as Wayland support mixed DPI ,and   there scale factors are sent properly over wl_output

But,when lack of `QT_SCREEN_SCALE_FACTORS` , some QT application,which only support `xWayland`  need `QT_AUTO_SCREEN_SCALE_FACTOR`  to `1` to make themselves scale properly

For example, under `xWayland`,with two mixed DPI screen : 
1. [`virtualbox`](https://software.manjaro.org/package/virtualbox) with `QT_AUTO_SCREEN_SCALE_FACTOR=0` looks like this very ugly,see attachment No.1
2. [`virtualbox`](https://software.manjaro.org/package/virtualbox) with `QT_AUTO_SCREEN_SCALE_FACTOR=1` , just looks well as windows/X11

I've tried to set `QT_AUTO_SCREEN_SCALE_FACTOR=1` via `/etc/environment` or `~/.config/plasma-workspace/env/*.sh` or via `systemd` ,none of these works . I've dive into the code and find out why:

1. `plasma` has settled the environment  here : https://invent.kde.org/plasma/plasma-workspace/-/blob/21cefd1083144e7bc51c6c9b46448a22b0a607f2/startkde/startplasma.cpp#L330 ,  and this `setupPlasmaEnvironment` is called after  `EnvironmentScripts` https://invent.kde.org/plasma/plasma-workspace/-/blob/21cefd1083144e7bc51c6c9b46448a22b0a607f2/startkde/startplasma-wayland.cpp#L64-L70 ,so environments settled in the `EnvironmentScripts` will be overwrite
1. `plasma`  [will export all the settled environment back to systemd/dbus](https://invent.kde.org/plasma/plasma-workspace/-/blob/21cefd1083144e7bc51c6c9b46448a22b0a607f2/startkde/startplasma-wayland.cpp#L76) , so  environments settled in the systemd/pam mechanise will be overwrite too

basically,I can do noting to change the value of environment variable `QT_AUTO_SCREEN_SCALE_FACTOR` ,which cause some QT application which only support `xWayland` scaled at wrong size and looks ugly

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: `Y`
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Comment 1 ihipop 2023-05-02 15:34:02 UTC
Created attachment 158626 [details]
virtualbox with QT_AUTO_SCREEN_SCALE_FACTOR=1 , just looks well as windows/X11
Comment 2 Nate Graham 2025-04-08 19:38:04 UTC
If you have apps that require QT_AUTO_SCREEN_SCALE_FACTOR to be set to something, then:
1. you should report this to the developers of the apps, because ideally this shouldn't be required
2. You can set it in the environment of each app as a workaround using KMenuEdit

But please do report it to the developers of the affected apps.
Comment 3 dantmnf 2025-04-10 12:24:46 UTC
The issue here is QT_AUTO_SCREEN_SCALE_FACTOR is (erroneously?) set to 0 in Plasma Wayland session, rather than leaving it unset: https://invent.kde.org/plasma/plasma-workspace/-/blob/90b914635b23a3f8a2ab6445cfa8b2f6468a2f44/startkde/startplasma.cpp#L357

In Plasma X11 sessions we set QT_SCREEN_SCALE_FACTORS which will override QT_AUTO_SCREEN_SCALE_FACTOR, but we are missing this for XWayland.
Comment 4 ihipop 2025-04-11 05:25:56 UTC
(In reply to dantmnf from comment #3)
> The issue here is QT_AUTO_SCREEN_SCALE_FACTOR is (erroneously?) set to 0 in
> Plasma Wayland session, rather than leaving it unset:
> https://invent.kde.org/plasma/plasma-workspace/-/blob/
> 90b914635b23a3f8a2ab6445cfa8b2f6468a2f44/startkde/startplasma.cpp#L357
> 
> In Plasma X11 sessions we set QT_SCREEN_SCALE_FACTORS which will override
> QT_AUTO_SCREEN_SCALE_FACTOR, but we are missing this for XWayland.

I second that, force it to "0"  and environments settled in the `EnvironmentScripts` will be overwritten, while X11 sessions works

The title should be reverted to its original purpose https://bugs.kde.org/show_activity.cgi?id=469273 because somebody changed it

which is "should we not enforce the environment of QT_AUTO_SCREEN_SCALE_FACTOR under wayland?"
Comment 6 Fushan Wen 2025-04-18 13:49:43 UTC
Git commit b19511f06176ea758259203f5b78a227a59b4867 by Fushan Wen, on behalf of Poscat.
Committed on 18/04/2025 at 13:48.
Pushed by fusionfuture into branch 'master'.

Avoid setting unneeded environment variable

This is override is unneeded. It was introduced as a workaround of a
QT bug that was subsequently fixed, and causes issues in some QT apps
such as vivado's docnav.

Closes https://invent.kde.org/plasma/plasma-workspace/-/issues/146
FIXED-IN: 6.4.0

M  +0    -4    startkde/startplasma.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/b19511f06176ea758259203f5b78a227a59b4867