Bug 433799

Summary: item geometries not created for new user accounts created using lookandfeel and/or layout templates
Product: [Plasma] plasmashell Reporter: Jeff Hodd <jghodd>
Component: Desktop ContainmentAssignee: Marco Martin <notmart>
Status: RESOLVED DUPLICATE    
Severity: major CC: A.Fettouhi, jghodd, nate, plasma-bugs
Priority: NOR    
Version: 5.21.1   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.21.4
Attachments: plasma desktop update javascript file
Sample look-and-feel with layout-template

Description Jeff Hodd 2021-03-01 17:13:05 UTC
Created attachment 136288 [details]
plasma desktop update javascript file

SUMMARY
When a new user account is created that uses a look-and-feel and/or layout template, although the applets are sized and situated correctly on first login, their geometries are not created on login or saved during logout. On second login, the applets are scrambled across the the desktop.

My observations are that a plasma shell update named move_desktop_layout_config.js is supposed to read the appletsrc file and rename ItemsGeometries under the General config group, rename it to ItemGeometriesHorizontal and move it to the top level Containment. This has apparently worked for a while, but as of plasma 5.21, ItemsGeometries is not created during the initial login, so move_desktop_layout_config.js is reading a non-existent property for a non-existent value and then assigning that empty value to ItemGeometriesHorizontal. On second (and subsequent) login(s), the applets are, of course, scrambled across the the desktop. Although moving the applets back into position and re-adjusting their sizes does update ItemGeometriesHorizontal, this is not an acceptable workaround.

Another observation is that moving or resizing any applet on your desktop after first login also flushes out ItemGeometriesHorizontal to appletsrc.

And the last observation is that, as of plasma 5.21, the desktop geometries are no longer being updated on logout. They are being updated when added, moved or resized (but not when added via look-and-feel and/or layout template).

STEPS TO REPRODUCE
1. Setup /etc/skel to use a look-and-feel and/or layout template by adding the lnf or template name to kdeglobals, kscreenlockerrc, ksplashrc, kwinrc and startupconfig.
2. Create a new user.
3. Login to the new account and check for ItemsGeometries or ItemGeometriesHorizontal in plasma-org.kde.plasma.desktop-appletsrc - neither exists
4. Logout from the new account
5. Login to the new account and check for ItemsGeometries or ItemGeometriesHorizontal in plasma-org.kde.plasma.desktop-appletsrc - neither exists and the desktop applets are completely scrambled across the desktop.

OBSERVED RESULT
ItemGeometriesHorizontal is not being created (or updated) in plasma-org.kde.plasma.desktop-appletsrc

EXPECTED RESULT
ItemGeometriesHorizontal should be created in plasma-org.kde.plasma.desktop-appletsrc

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: linux-5.11.2, plasma-5.21
(available in About System)
KDE Plasma Version: 5.21
KDE Frameworks Version: 5.2.2
Qt Version: 5.15.1

ADDITIONAL INFORMATION
I've created a workaround script installed into /usr/share/plasma/shells/org.kde.plasma.desktop/contents/updates named verify_geometries.js so that it runs last. I tried other positions for running this script and last is the only position that works. I've attached the javascript file.
Comment 1 Nate Graham 2021-03-02 16:22:15 UTC
Thanks for the investigation. Would you be interested in digging even deeper and submitting a merge request to fix the problem? Seems like you're more than halfway there!
Comment 2 Jeff Hodd 2021-03-03 00:22:44 UTC
Given the sheer volume of code to pour through, I was kinda hoping someone who knows plasma-workspace inside and out might be the best kind of person to look into this, Nate. Just a cursory investigation reveals that geometry is manipulated in dozens of source files, although shell/shellcorona.h/cpp appears to be a key component. There are also quite a number of locations where geometry-changed signals are set up (connected) and/or activated. But I don;t have any kind of birds-eye view of how the whole thing works - thus the need for a developer who knows how all the pieces fit together.
Comment 3 Nate Graham 2021-03-03 00:56:32 UTC
I wish I could help you, but I'm more or less in the same boat. :)
Comment 4 Jeff Hodd 2021-03-03 01:56:40 UTC
Can this be assigned to someone else, then?
Comment 5 Nate Graham 2021-03-03 18:41:39 UTC
It's not really assigned to anyone right now (despite the "assignee" field listing Marco Martin)
Comment 6 Jeff Hodd 2021-03-04 00:59:00 UTC
Yeah, I saw the assignee, but no response at all. This is a fairly significant change in behavior between v5.20 and 5.21, so I'd have expected some response by now.

Are you experiencing the same issue, Nate?
Comment 7 Nate Graham 2021-03-04 14:30:17 UTC
No, I'm not.
Comment 8 Jeff Hodd 2021-03-05 07:32:50 UTC
Let me see if I can snag a copy of the 5.20.x plasma-workspace source code and I'll see if I can pinpoint some of the more interesting differences. I'll also dig around some in the 5.21.x code and try to pinpoint the geometryChanged event method signature - that would at least be something I can easily trace through the rest of the code.
Comment 9 Marco Martin 2021-03-05 15:22:08 UTC
(In reply to Jeff Hodd from comment #6)
> Yeah, I saw the assignee, but no response at all. This is a fairly
> significant change in behavior between v5.20 and 5.21, so I'd have expected
> some response by now.

I'm trying to reproduce, without much success so far, the coe responsible for all this stuff is in plasma-workspace/components/containmentlayoutmanager/

I'll do some more tests
Comment 10 Jeff Hodd 2021-03-05 16:12:08 UTC
Created attachment 136400 [details]
Sample look-and-feel with layout-template
Comment 11 Jeff Hodd 2021-03-05 16:20:42 UTC
I've attached a sample look-and-feel with layout-template that includes 7 desktop applets. They're assigned in the following .config files:

kdeglobals:LookAndFeelPackage=org.bluestarlinux.archlogo
kscreenlockerrc:Theme=org.bluestarlinux.archlogo
ksplashrc:Theme=org.bluestarlinux.archlogo
kwinrc:DesktopLayout=org.bluestarlinux.archlogo
kwinrc:DesktopListLayout=org.bluestarlinux.archlogo
kwinrc:LayoutName=org.bluestarlinux.archlogo
startupconfig:ksplashrc_ksplash_theme=org.bluestarlinux.archlogo

In the past, I've found that often timing is the issue. The more complex the setup, the longer it takes. If plasma assesses the layout too soon, it misses most of the setup. Might be that now, might not.

Let me know if you need the wallpaper. The look-and-feel pulls it from its own artwork, so if the lnf is added to the config files in your skel directory, you should be able to create a new user, then login as that user to see the issue.
Comment 12 Jeff Hodd 2021-03-05 16:25:01 UTC
I do want to add, though, that the usual behaviour of saving off the geometries on logout is absolutely not working on first login (initial session). Resizing or moving any of the applets after first login (during the initial session) will flush out the geometries. I cannot use this as a workaround, however. I distribute to a couple of thousand users a month and getting them all to move or resize an applet on initial session would absolutely not work.
Comment 13 Bug Janitor Service 2021-03-05 17:06:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/696
Comment 14 Jeff Hodd 2021-03-05 17:09:49 UTC
That sounds like a good place to start. Thanks, Martin.
Comment 15 Jeff Hodd 2021-03-05 21:45:35 UTC
Am doing a test build. I'll let you know if that fixes it. The source code changes appear to be what's needed.
Comment 16 Jeff Hodd 2021-03-06 01:47:38 UTC
That does indeed fix the issue. Thanks much, Martin.
Comment 17 Jeff Hodd 2021-03-06 18:23:17 UTC
My apologies, Marco. Somehow managed to get your name reversed. Thank you for the merge-request. It resolves the issue.
Comment 18 Marco Martin 2021-03-16 09:08:42 UTC
*** Bug 413645 has been marked as a duplicate of this bug. ***
Comment 19 Marco Martin 2021-03-19 14:50:40 UTC
Git commit 110260424669b7424f93b5678a5a2f4ed87ebf6a by Marco Martin.
Committed on 19/03/2021 at 10:10.
Pushed by mart into branch 'master'.

save layout when corona startup is completed

When the component is completed the corona startup may not be complete
yet.
This causes a race condition when most of the times when a layout
is created from a lajout.js file, applets geometries don't get correctly
saved.
so reinvoke the save timer when the startup completed signal is emitted
from corona

M  +2    -2    components/containmentlayoutmanager/appletslayout.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/110260424669b7424f93b5678a5a2f4ed87ebf6a
Comment 20 Nate Graham 2021-03-19 15:23:52 UTC
Git commit dbdf3b1873aa8c96760b4015adb145bf0ec098a1 by Nate Graham, on behalf of Marco Martin.
Committed on 19/03/2021 at 15:23.
Pushed by ngraham into branch 'Plasma/5.21'.

save layout when corona startup is completed

When the component is completed the corona startup may not be complete
yet.
This causes a race condition when most of the times when a layout
is created from a lajout.js file, applets geometries don't get correctly
saved.
so reinvoke the save timer when the startup completed signal is emitted
from corona


(cherry picked from commit 110260424669b7424f93b5678a5a2f4ed87ebf6a)

M  +2    -2    components/containmentlayoutmanager/appletslayout.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/dbdf3b1873aa8c96760b4015adb145bf0ec098a1
Comment 21 Jeff Hodd 2021-04-02 18:04:30 UTC
Any chance we could re-open this bug?

I'm seeing the same issue, and worse, again. I'm building my own sub-version 5.21.3 for my users with this code-change added, and I'm getting reports that the theme is still only randomly coming up. The worse is that latte-dock, autostarted from ~/.config/autostart, is also only starting randomly now. What kind of changes are being made to cause all of these random timing issue on startup?
Comment 22 Jeff Hodd 2021-04-02 18:07:00 UTC
sorry - *sub-version of 5.21.3
and - *these random timing issues
Comment 23 Nate Graham 2022-03-25 16:36:16 UTC

*** This bug has been marked as a duplicate of bug 413645 ***