Bug 493569

Summary: loss of icon position on the desktop
Product: [Plasma] plasmashell Reporter: painless roaster <painless.roaster>
Component: FolderAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: akselmo, heematux, hein, nate, notmart, Wi11iam_1
Priority: NOR Keywords: multiscreen, regression
Version: 6.1.5   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=468546
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description painless roaster 2024-09-24 08:32:27 UTC
loss of icon position on the desktop after these actions:
 1) turning the monitor off and on
 2) suspend & resume if an external monitor is connected
Comment 1 Akseli Lahtinen 2024-09-24 08:41:14 UTC
Can reproduce 1, cant test 2 

The icons seem to only lose their position if desktop is not selected:

1. Add icons to desktop
2. Click on desktop or select any of the files so that theyre hilighted
3. Turn monitor on and off
4. This time icons should stay in position

Now do same steps, but in step 2: Click on any window so that desktop is not active.

Now icons lose position.

Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.90
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.10.10-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15,5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 2 Bug Janitor Service 2024-10-01 13:15:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2562
Comment 3 Akseli Lahtinen 2024-10-01 14:31:14 UTC
Git commit ad1162258ddb1d30e07f9e4d909afec5cf88aa36 by Akseli Lahtinen.
Committed on 01/10/2024 at 13:14.
Pushed by akselmo into branch 'master'.

FolderViewLayer.qml: Load the icon positions when geometry changes

We need to load the icon positions when screen geometry changes,
otherwise we risk using wrong geometry when screen is turned off or
otherwise changed, then saving the icon positions of that geometry.

For example, when turning off screen in single-monitor setup,
the resolution will change to 0x0. This then moves the icons around.
Then opening the screen doesn't move the icons, so the icons stay in the
0x0 positions, and save them to the "normal" resolution.

This fixes it by loading the positions whenever the geometries change

M  +9    -0    containments/desktop/package/contents/ui/FolderViewLayer.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/ad1162258ddb1d30e07f9e4d909afec5cf88aa36
Comment 4 Akseli Lahtinen 2024-10-01 14:48:00 UTC
Git commit 96b04ec7deaf1a03786cf0c74976a7ed35cd1ade by Akseli Lahtinen.
Committed on 01/10/2024 at 14:33.
Pushed by akselmo into branch 'Plasma/6.2'.

FolderViewLayer.qml: Load the icon positions when geometry changes

We need to load the icon positions when screen geometry changes,
otherwise we risk using wrong geometry when screen is turned off or
otherwise changed, then saving the icon positions of that geometry.

For example, when turning off screen in single-monitor setup,
the resolution will change to 0x0. This then moves the icons around.
Then opening the screen doesn't move the icons, so the icons stay in the
0x0 positions, and save them to the "normal" resolution.

This fixes it by loading the positions whenever the geometries change


(cherry picked from commit ad1162258ddb1d30e07f9e4d909afec5cf88aa36)

ad116225 FolderViewLayer.qml: Load the icon positions when geometry changes

Co-authored-by: Akseli Lahtinen <akselmo@akselmo.dev>

M  +9    -0    containments/desktop/package/contents/ui/FolderViewLayer.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/96b04ec7deaf1a03786cf0c74976a7ed35cd1ade
Comment 5 William 2024-10-12 14:35:59 UTC
this does not seem to be resolved - it is happening on single monitor, single dedicated amd-gpu fresh install of tumbleweed with plasma 6.2.0.-
I suspect its still an issue where positions are read and saved at the same time as you can sometimes end up with "zombie" icons after a monitor power off/on that just show but are not clickable and follow other icons around if you drag them...
Comment 6 Heema 2024-10-17 18:18:26 UTC
it seams thats its not fixed, with this latest plasma-desktop update the desktop icons lose position every time the screen locks then unlocks or play a game then return to the desktop (i am assuming every time it refreshes the desktop)
Comment 7 Akseli Lahtinen 2024-10-18 09:45:15 UTC
Will try to reproduce again, but you may have to manually move the icons yourself after this version since it has to rewrite over the old icon position data. When that is done, it should remember the positions.
Comment 8 William 2024-10-19 17:13:42 UTC
this happens 100% reliably every single time turing monitor off and back on. not with games or lockscreen though only monitor power cycles. doesnt matter if i select desktop or any icons on it - still they get scrambled. happens of fresh install (tumbleweed) when u just put a single icon onto the desktop. Also if u power cycle monitor enough u can create "zombie" icons that cant be clicked. things were not as bad before 6.2 - pls ensure desktop positions are not updated while previous state is "stored".
Comment 9 William 2024-10-21 16:24:18 UTC
by playing around with the desktop folderview settings i made following revelation:
the bug happens only when sort mode "left to right" is active (which is the default) and not when "top to bottom" is selected.
This sounds weird but settings are confusing and icons are not sorted after anything (set to "manual") so why does a sort order have any impact when it should never apply..

"locking" the icons has also no effect other than that you cant fix them manually after they get scrambled
all the other possible settings also dont affect it.
tested on fresh install - simply switching the sort order fixes it - then you can sort your items manually once and they actually stay. 
Why not simply remove all the auto sorting stuff that noone uses anyway when it seems to mess with user preffered positions this much...
Comment 10 Heema 2024-10-21 17:44:14 UTC
(In reply to William from comment #9)
> by playing around with the desktop folderview settings i made following
> revelation:
> the bug happens only when sort mode "left to right" is active (which is the
> default) and not when "top to bottom" is selected.
> This sounds weird but settings are confusing and icons are not sorted after
> anything (set to "manual") so why does a sort order have any impact when it
> should never apply..
> 
> "locking" the icons has also no effect other than that you cant fix them
> manually after they get scrambled
> all the other possible settings also dont affect it.
> tested on fresh install - simply switching the sort order fixes it - then
> you can sort your items manually once and they actually stay. 
> Why not simply remove all the auto sorting stuff that noone uses anyway when
> it seems to mess with user preffered positions this much...

i also had sort mode "left to right" and sorting to manual, changed sort mode to "top to bottom" them manually reorganized them back
then tried locking and unlocking and playing a game then exiting and the bug did happen, so it seams that it connected to the sort option
Comment 11 Akseli Lahtinen 2024-10-22 08:48:32 UTC
Yeah I can repro the issue again.. Looking into it

Operating System: Fedora Linux 40
KDE Plasma Version: 6.2.80
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2
Kernel Version: 6.11.3-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15,5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 12 Bug Janitor Service 2024-10-22 14:56:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2599
Comment 13 Nate Graham 2024-10-23 18:01:47 UTC
When the icons lose their positions, do they reset to alphabetical order? Or is the order they appear in something different?

If it's alphabetical order, this is Bug 482875.
Comment 14 Nate Graham 2024-10-23 18:12:25 UTC
Never mind, it's only alphabetical the first time; after that it's random-looking. So yeah, this is Bug 482875.

*** This bug has been marked as a duplicate of bug 482875 ***
Comment 15 Akseli Lahtinen 2024-10-24 09:42:13 UTC
Git commit e82c44ef2145362063633779e3cfa49cb154d6bf by Akseli Lahtinen.
Committed on 24/10/2024 at 09:42.
Pushed by akselmo into branch 'master'.

positioner: Make sure we check deferMovePositions exist

Checking `m_deferMovePositions.count()` seems to be always true,
even when its empty.

Make sure we check the size is more than 0 so we don't move items
around without any reason to do so.

We also do not emit `positionsChanged` if we have not even touched the positions,
to avoid deleting old configuration

M  +5    -6    containments/desktop/plugins/folder/positioner.cpp

https://invent.kde.org/plasma/plasma-desktop/-/commit/e82c44ef2145362063633779e3cfa49cb154d6bf
Comment 16 Bug Janitor Service 2024-10-24 09:46:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2602
Comment 17 Akseli Lahtinen 2024-10-24 09:58:07 UTC
Git commit 816e982e0da6266e0a489b10296f4e3b3b833e11 by Akseli Lahtinen.
Committed on 24/10/2024 at 09:46.
Pushed by akselmo into branch 'Plasma/6.2'.

positioner: Make sure we check deferMovePositions exist

Checking `m_deferMovePositions.count()` seems to be always true,
even when its empty.

Make sure we check the size is more than 0 so we don't move items
around without any reason to do so.

We also do not emit `positionsChanged` if we have not even touched the positions,
to avoid deleting old configuration


(cherry picked from commit e82c44ef2145362063633779e3cfa49cb154d6bf)

ff93aa2c positioner: Make sure we check deferMovePositions exist
5326625b Only update positions if we have actually touched them

Co-authored-by: Akseli Lahtinen <akselmo@akselmo.dev>

M  +5    -6    containments/desktop/plugins/folder/positioner.cpp

https://invent.kde.org/plasma/plasma-desktop/-/commit/816e982e0da6266e0a489b10296f4e3b3b833e11
Comment 18 Bug Janitor Service 2024-10-24 15:00:57 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2603