Bug 494412

Summary: Icons on primary desktop are moving to secondary desktop on next reboot
Product: [Plasma] plasmashell Reporter: Miguel Rozsas <miguel>
Component: FolderAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: akselmo, hein, nate, notmart
Priority: NOR Keywords: multiscreen
Version: 6.2.0   
Target Milestone: 1.0   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 6.3.0
Sentry Crash Report:

Description Miguel Rozsas 2024-10-10 11:56:23 UTC
SUMMARY
I've 2 monitors and 2 activities.
One the primary monitor, first activity, the icons on this workspace keep moving the the second monitor after a new session, (I move it back to primary monitor after login - 2 of then are standard kde icons: Trashcan and Personal Folders, the others are Steam related icons)
On the second activity, they remain on their place, I mean, on primary monitor.

STEPS TO REPRODUCE
1.  Have some icons on primary monitor, first activity and power off the computer
2. Power on the computer and login
3. Notice all icons on first monitor, fist activity are now on the second monitor, first activity; the icons on  second activity remains undisturbed.

OBSERVED RESULT
Notice all icons on first monitor, fist activity are now on the second monitor, first activity; the icons on  second activity remains undisturbed.

EXPECTED RESULT
The icons should remain in their place between logins.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20241007
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.3
Kernel Version: 6.11.2-1-default (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 7600X 6-Core Processor
Memory: 30.6 GiB of RAM
Graphics Processor: AMD Radeon RX 6600

ADDITIONAL INFORMATION
I've 2 monitors:
A DisplayPort Dell plugged on the first port of video card.
A HDMI Samsung plugged on the second port of video card.
The first /primary monitor is not the original primary monitor. 
On KDE settings I swapped the f monitor order or positions to get the HDMI Samsung as primary and the DisplayPort Dell as secondary (at left, Samsung; at right, Dell)
Comment 1 Akseli Lahtinen 2024-10-10 13:11:09 UTC
Do they move around every time, or just this one time?
Comment 2 Nate Graham 2024-10-10 20:35:11 UTC
Also, is this a regression in Plasma 6.2, or has it been this way for a while?
Comment 3 Miguel Rozsas 2024-10-10 22:17:33 UTC
(In reply to Akseli Lahtinen from comment #1)
> Do they move around every time, or just this one time?

Not every time. 3 reboots since the report and didn't happen a second time, so far.
It used to happen more frequently in previous versions in the 6.1.x , but not in the last ones....
Comment 4 Miguel Rozsas 2024-10-10 22:17:59 UTC
(In reply to Nate Graham from comment #2)
> Also, is this a regression in Plasma 6.2, or has it been this way for a
> while?

It used to happen more frequently in previous versions in the 6.1.x , but not in the last ones....
Comment 5 Miguel Rozsas 2024-10-17 11:57:56 UTC
today, again !
This time all  icons  on left monitor on activity 2 are moved to second/right monitor and all widgets (except the sticky notes  ) on second/right monitor disappear.
Icons and widgets on first activity are untouched.
This is so frustrating, aff.
You spend a time to rice the desktop and BUM, everything is lost/messy.
Comment 6 Akseli Lahtinen 2024-10-18 09:42:48 UTC
I will have to try to reproduce this, but the current situation is that you may have to set them up at least once if they restart, and then they should remember their positions. The old code was bit too eager to save the new positions every time, even when they shouldn't.

Do share if this happens again, so if it does, it's likely related to activities. I will try to reproduce this on my end too.
Comment 7 Akseli Lahtinen 2024-11-06 16:30:33 UTC
Git commit cc44615b34dacc2a4acfdc82de885c943318a7f6 by Akseli Lahtinen.
Committed on 06/11/2024 at 16:30.
Pushed by akselmo into branch 'master'.

Refactor icon positioner saving and loading

The icon positioner saving and loading is handled by QML, which makes it a bit difficult
to work with the logic in positioner CPP files.

This change does the following:
- Explicitly save only on user interactions
- Moved the save and load of config to positioner.cpp
  - Easier debugging of the saving and loading functions
  - Still uses the JSON style of save/loading like the old one
    - Technically should be compatible with the old config, which was also JSON.
- Makes positionerApplet accessible from FolderView qml
- Various checks for checking if screen is enabled or not to avoid doing unnecessary work when screen is off
- A lot of fixes to avoid any racing conditions
- Removed any timers
- Added various unit tests

Alternative to https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2603
Related: bug 482875, bug 494874, bug 472137, bug 433867, bug 468619, bug 449069, bug 495047, bug 453314
FIXED-IN: 6.3.0

M  +1    -1    containments/desktop/package/contents/ui/FolderView.qml
M  +1    -48   containments/desktop/package/contents/ui/FolderViewLayer.qml
M  +165  -26   containments/desktop/plugins/folder/autotests/positionertest.cpp
M  +18   -3    containments/desktop/plugins/folder/autotests/positionertest.h
M  +23   -7    containments/desktop/plugins/folder/foldermodel.cpp
M  +5    -0    containments/desktop/plugins/folder/foldermodel.h
M  +176  -60   containments/desktop/plugins/folder/positioner.cpp
M  +37   -8    containments/desktop/plugins/folder/positioner.h

https://invent.kde.org/plasma/plasma-desktop/-/commit/cc44615b34dacc2a4acfdc82de885c943318a7f6