Bug 423600

Summary: Desktop inherits DPI setting from SDDM login manager after first login
Product: [Plasma] plasmashell Reporter: akb825 <akb825>
Component: Startup processAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: caiot5, frederic.parrenin, kde, nate, pecosdave, plasma-bugs, postix, xanaddams
Priority: NOR    
Version: 5.27.3   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: The correct result on the first login and when the KDE and SDDM settings are synchronized.
The desktop elements being too small on the second login with the default (non-synchronized) settings.
The desktop elements being too large after setting a very high DPI for SDDM.

Description akb825 2020-06-27 22:36:04 UTC
SUMMARY
After logging off and logging back in, the Plasma Desktop (including desktop icons, context menu, panel, etc.) will use the DPI settings from the login manager. (e.g. SSDM) Other applications will properly use the KDE settings.

STEPS TO REPRODUCE
1. Have the login manager use a different DPI setting from KDE.
2. Log into KDE.
3. Log out.
4. Log back into KDE.

OBSERVED RESULT
On the second login, the desktop will have the DPI scaling from the login manager.

EXPECTED RESULT
The desktop always respects the KDE settings.

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 5.19.2
KDE Frameworks Version: 5.71.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
This can be worked around by synchronizing the login manager settings with KDE from the Login Screen control panel.
Comment 1 Nate Graham 2020-07-02 00:36:49 UTC
What did you do to "Have the login manager use a different DPI setting from KDE"?
Comment 2 akb825 2020-07-02 01:07:07 UTC
If the DPI scaling isn't 100%, it will be different for the login manager by default unless you manually synchronize the settings under the Advanced section of the "Login Screen (SDDM)" control panel.

If you have synchronized the settings, it will have a section that looks like this in /etc/sddm.conf.d/kde_settings.conf:

[X11]
ServerArguments=-dpi 192

You can either change this section or modify the dpi argument value to force them to differ.
Comment 3 Nate Graham 2020-07-02 01:39:58 UTC
Yes, and I've done that on my system which has a 4K screen.

I'm having a hard time understanding the issue. Can you clarify what you mean by "the desktop will have the DPI scaling from the login manager."? So the system will have 192 DPI? What DPI should it be using instead in your case?
Comment 4 akb825 2020-07-02 05:44:38 UTC
In this case, the "-dpi 192" option was set after synchronizing with the KDE settings. However, if I remove this setting, based on the size of the UI elements I believe it was using a default of 96.

When it was originally using this default of 96 for the login manager, the Plasma desktop would display correctly the first time I logged in after booting. (with the DPI of 192 from the KDE settings) However, if I logged out and logged back in it would inherit the DPI of 96 from the login manager. As a result, the desktop icons, desktop context menu, and panel menus all were very small. Other applications would display correctly. Once the settings were synchronized, which added the "-dpi 192" option to the sddm config, the desktop would display correctly regardless of how many times I log out and back on.
Comment 5 Nate Graham 2020-07-03 15:17:18 UTC
Aha. I think you're just hitting the general problem of plasma not using Qt scaling yet. I'm not convinced that SDDM is involved at all, but your symptoms match a description of not using Qt scaling.

If you set PLASMA_USE_QT_SCALING=1 in the environment when plasma starts up, does the problem disappear?
Comment 6 akb825 2020-07-03 20:31:00 UTC
> I'm not convinced that SDDM is involved at all, but your symptoms match a description of not using Qt scaling.

I believe that the SDDM settings are merely the trigger for the bug in Plasma. The  DPI settings for XOrg being mismatched from KDE cause the scaling for Plasma to be incorrect on the second launch/login.

> If you set PLASMA_USE_QT_SCALING=1 in the environment when plasma starts up, does the problem disappear?

No, the problem persists. I can tell that some of the scaling behavior is different because the panel height and context menu icons are doubled in size. The panel height and icon size remain consistent between logging out and logging back in, but the text is 1/2 the size after the second login.
Comment 7 akb825 2020-07-03 20:58:51 UTC
To provide a bit more info, the example numbers I used were for my laptop. I also have a desktop with 4k monitors, but the specific DPI settings are a bit different: I have the KDE set to use 120 DPI, but the default for XOrg (when not setting the -dpi option for ServerArguments in the SDDM config) appears to be 192. As a result, the Plasma desktop and panel items are actually *larger* on the second login, as opposed to smaller on the laptop.

In both cases, the default XOrg DPI is different (96 for laptop, 192 for desktop) and on the second login Plasma's DPI scale appears to match XOrg's DPI. This is why I believe that Plasma is inheriting the XOrg DPI value on the second login rather than respecting the KDE setting.
Comment 8 Nate Graham 2020-07-07 17:59:37 UTC
Sounds like you've set the DPI in various places, and I have a feeling that's causing some mismatches between things.

The only officially supported method of adjusting the scaling is using the global scale setting in the KScreen KCM. Can you reproduce the issue when you turn off all the other stuff and just use that?
Comment 9 akb825 2020-07-08 22:38:51 UTC
On my laptop I only adjusted the scaling by setting the global scale to 200% in the Display Configuration control panel. (which I'm assuming is the KScreen KCM you're referring to) However, this setting doesn't apply to SDDM unless you manually synchronize the settings in the Login Screen (SDDM) control panel.

To summarize:
* The DPI was only configured in a single place. (global scale in display settings)
* By default, the DPI set in KDE may be mismatched with SDDM.
* Manually synchronizing the settings in the SDDM control panel fixes the mismatch.

I will note that this used to work, so it's a regression that was introduced in some recent version.
Comment 10 Nate Graham 2020-07-09 18:05:22 UTC
(In reply to akb825 from comment #9)
> On my laptop I only adjusted the scaling by setting the global scale to 200%
> in the Display Configuration control panel. (which I'm assuming is the
> KScreen KCM you're referring to)
Correct.

> However, this setting doesn't apply to SDDM
> unless you manually synchronize the settings in the Login Screen (SDDM)
> control panel.
Correct.

All of this is intentional. What's the problem again?
Comment 11 akb825 2020-07-09 18:32:55 UTC
The problem is Plasma desktop has the following behavior:
* The first time logging on after booting, it correctly takes KDE's DPI.
* The second time logging on (and each time following) it takes SDDM's DPI.

All other applications take the KDE settings regardless of how many times you log out and log back in.
Comment 12 Nate Graham 2020-07-09 19:00:25 UTC
But you said that you synced the DPI to SDDM, so it the values should be identical, right?
Comment 13 akb825 2020-07-09 19:36:33 UTC
Yes, syncing the SDDM settings works around the problem. It basically hides the bug, but it took quite a bit of digging around to track down.

Let's say I'm a normal user of KDE and just set up my machine. I have a high DPI display, so I set my global scale to 200%. The login screen is a bit small, but that's not a big deal. However, sometimes when I log in my desktop and panel menus are smaller than normal. Rebooting fixes the problem.

Out of the box it's broken. Fixing it requires two things:
1. Deducing that the problem is related to the login screen DPI. Since it's inconsistent, that might be a little difficult to deduce.
2. Knowing that you can synchronize the login settings. That requires some spelunking through the settings.

The fact that there is a workaround doesn't mean there is no problem. The fact that Plasma doesn't always respect the KDE settings is a bug. It results in strange behavior, and finding that workaround when you only see the problem takes quite a bit of effort.
Comment 14 Nate Graham 2020-07-09 20:28:12 UTC
The idea of Plasma using SDDM's default DPI seems very bizarre to me and I suspect this is likely a coincidence, but at this point I'm prepared to be convinced of anything. :)

Any chance you tan take a screenshot of the too-small elements in Plasma? Is it limited to panel thickness and icons in context menus and buttons?
Comment 15 akb825 2020-07-10 08:10:55 UTC
Created attachment 130022 [details]
The correct result on the first login and when the KDE and SDDM settings are synchronized.
Comment 16 akb825 2020-07-10 08:12:01 UTC
Created attachment 130023 [details]
The desktop elements being too small on the second login with the default (non-synchronized) settings.
Comment 17 akb825 2020-07-10 08:12:35 UTC
Created attachment 130024 [details]
The desktop elements being too large after setting a very high DPI for SDDM.
Comment 18 akb825 2020-07-10 08:19:30 UTC
I've attached three screenshots:
1. The correct results shown with the first login after booting and after synchronizing the SDDM settings with KDE.
2. The desktop elements too small after logging in a second time with the default (unsynchronized) settings.
3. The desktop elements too large after setting the SDDM DPI to 384 and logging in a second time.

This shows the desktop icons, panel text, and panel menu having the incorrect DPI. I could only show so much with a single screenshot, but the right-click contextual menu for the desktop has the same issues. Other programs display correctly.

I believe this pretty conclusively demonstrates that Plasma is using the SDDM DPI after logging on a second time rather than using the KDE settings.
Comment 19 Nate Graham 2020-07-10 18:33:29 UTC
Thanks for the screenshots, and thanks for your patience.

I'm pretty thoroughly lost and confused at this point, so I'll let more experienced Plasma developers continue the investigation.
Comment 20 Nate Graham 2020-07-12 02:56:53 UTC
Got another report of this: https://www.reddit.com/r/kde/comments/hphxx4/sddm_scaling_on_4k_display/

Apparently somehow the DPI set in SDDM does indeed leak into the session in cases where it differs from the Force Font DPI setting in the Fonts KCM.
Comment 21 Nate Graham 2020-07-24 20:51:24 UTC
*** Bug 418546 has been marked as a duplicate of this bug. ***
Comment 22 Caio Fratelli 2022-01-01 10:29:47 UTC
The bug is still present on 5.22.5, however workaround doesn't seem to work. 
If I synchronize the settings between plasma and sddm, this changes nothing and the login screen is still being shown as 4k before login (after login if I lock the screen again it would then respect the KDE settings).
Comment 23 frederic.parrenin@univ-grenoble-alpes.fr 2022-07-20 18:17:47 UTC Comment hidden (spam)
Comment 24 Nate Graham 2023-03-08 15:09:02 UTC
People affected by this: are you using an openSUSE_based distro?
Comment 25 Alexander 2023-03-15 17:53:55 UTC Comment hidden (spam)
Comment 26 Nate Graham 2023-03-15 19:33:07 UTC Comment hidden (spam)
Comment 27 Nate Graham 2023-03-15 19:34:07 UTC
(In reply to Nate Graham from comment #24)
> People affected by this: are you using an openSUSE_based distro?

Waiting for an answer to this. Where "this" means "the originally reported issue in the description field, not other unrelated hidpi scaling issues on the SDDM login scree itself" :)
Comment 28 Alexander 2023-03-30 01:23:21 UTC
(In reply to akb825 from comment #2)
> If the DPI scaling isn't 100%, it will be different for the login manager by
> default unless you manually synchronize the settings under the Advanced
> section of the "Login Screen (SDDM)" control panel.
> 
> If you have synchronized the settings, it will have a section that looks
> like this in /etc/sddm.conf.d/kde_settings.conf:
> 
> [X11]
> ServerArguments=-dpi 192
> 
> You can either change this section or modify the dpi argument value to force
> them to differ.

So I switched from KDE Neon to openSuse TW just to see if it was the same issue and yep, there it is. In the /etc/sddm.conf.d/kde_settings.conf the dpi was set to zero like  "ServerArguments=-dpi 0".  I changed it to 192 and the scaling was correct on logout. For some reason, it is not pulling the sync.
Comment 29 Bug Janitor Service 2023-04-14 03:45:40 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 30 Bug Janitor Service 2023-04-29 03:46:18 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 31 David Monroe 2023-10-23 16:47:40 UTC
The info is:

It's very real and still happening.

I got a new laptop recently with a 4K built in screen.  When I'm on just the laptop I like it scaled to about 175%, the text it just too small on a 16" screen native-sized at 4K.  When I adjusted this something adjusted the scaling in sddm - I did not set it manually.

KDE is supposed to remember my monitor layout, this is made obvious in the GUI by the "just this configuration" check-box. I use three 1080 screens on a dock when I'm not using the laptop screen, but SDDM comes up huge when I have those when I log in, and when I get to my desktop it's 175% even with the laptop closed.  KDE reports the resolution a 4K when I first bring up the adjustments, until I actually click on a monitor, where it's right.  This is with the lid closed and the 4K screen inactive.  It's as though it thinks the 4K screen is in charge even with the lid closed and doesn't realize it's not until I click on one of the enabled monitors.  Then the scaling won't change until I log out and back in again, which doesn't work because SDDM immediately switched back to putting the 4K display in charge.

I manually corrected for myself.

When I set:  ServerArguments=-dpi 96
in /etc/sddm.conf.d/kde_settings.conf

Everything as right.  KDE inherits this from SDDM's kde_settings.conf

I had to do it that way.  When I set the scaling in the GUI and logged out/back in it made no difference.
I've had other issues with "this configuration" settings and monitors.  Sometimes, when any setting in the OS changes, like plugging an arbitrary USB device in, my monitors scramble positions.  My Samsung monitor is on the left, but if I do anything to my laptop it likes to move it to the middle for no good reason, this could be because I connected a Bluetooth mouse.
Comment 32 Caio Fratelli 2023-10-23 18:08:11 UTC
(In reply to David Monroe from comment #31)
> The info is:
> 
> It's very real and still happening.
> 
> I got a new laptop recently with a 4K built in screen.  When I'm on just the
> laptop I like it scaled to about 175%, the text it just too small on a 16"
> screen native-sized at 4K.  When I adjusted this something adjusted the
> scaling in sddm - I did not set it manually.
> 
> KDE is supposed to remember my monitor layout, this is made obvious in the
> GUI by the "just this configuration" check-box. I use three 1080 screens on
> a dock when I'm not using the laptop screen, but SDDM comes up huge when I
> have those when I log in, and when I get to my desktop it's 175% even with
> the laptop closed.  KDE reports the resolution a 4K when I first bring up
> the adjustments, until I actually click on a monitor, where it's right. 
> This is with the lid closed and the 4K screen inactive.  It's as though it
> thinks the 4K screen is in charge even with the lid closed and doesn't
> realize it's not until I click on one of the enabled monitors.  Then the
> scaling won't change until I log out and back in again, which doesn't work
> because SDDM immediately switched back to putting the 4K display in charge.
> 
> I manually corrected for myself.
> 
> When I set:  ServerArguments=-dpi 96
> in /etc/sddm.conf.d/kde_settings.conf
> 
> Everything as right.  KDE inherits this from SDDM's kde_settings.conf
> 
> I had to do it that way.  When I set the scaling in the GUI and logged
> out/back in it made no difference.
> I've had other issues with "this configuration" settings and monitors. 
> Sometimes, when any setting in the OS changes, like plugging an arbitrary
> USB device in, my monitors scramble positions.  My Samsung monitor is on the
> left, but if I do anything to my laptop it likes to move it to the middle
> for no good reason, this could be because I connected a Bluetooth mouse.

I can confirm, this is still happening for me as well.
Comment 33 Nate Graham 2023-10-23 18:52:26 UTC
For folks experiencing the symptoms of the issue, can you mention:
- Your distro
- Your Plasma version
- Your SDDM version
- Whether SDDM is running in native Wayland mode, either because your distro configures it this way (e.g. Fedora does) or you manually forced it into this mode
- Whether it happens only in the Plasma X11 session, or only in the Plasma Wayland session, or both
Comment 34 Bug Janitor Service 2023-11-07 03:45:43 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 35 Caio Fratelli 2023-11-15 11:01:56 UTC
(In reply to Nate Graham from comment #33)
> For folks experiencing the symptoms of the issue, can you mention:
> - Your distro
> - Your Plasma version
> - Your SDDM version
> - Whether SDDM is running in native Wayland mode, either because your distro
> configures it this way (e.g. Fedora does) or you manually forced it into
> this mode
> - Whether it happens only in the Plasma X11 session, or only in the Plasma
> Wayland session, or both

Distro: Kubuntu 22.04
Plasma version: 5.24.7
SDDM version: 0.19.0-2
It happens only with wayland.
Comment 36 Nate Graham 2023-11-16 22:10:43 UTC
Is anyone able to reproduce the issue with Plasma 5.27 and SDDM 0.20?
Comment 37 Bug Janitor Service 2023-12-01 03:45:46 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 38 Bug Janitor Service 2023-12-16 03:45:58 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!