Bug 468546

Summary: Desktop icons reset position when switching between laptop and external displays with different resolutions
Product: [Plasma] plasmashell Reporter: i.Dark_Templar <idarktemplar>
Component: FolderAssignee: Plasma Bugs List <plasma-bugs>
Status: NEEDSINFO WAITINGFORINFO    
Severity: normal CC: alexvkaam, boot.efi, dashonwwIII, EpicTux123, f.alexander.wilms, hein, idarktemplar, katonag, kdedev, linuxboy, lloyd.osten, matt.fagnani, mt190502, n2thew, nate, nk0885, notmart, pasdabonnements, postix, quanticcpu2100, rpc, sollacea, thomas, typingcat, waldostealthmode
Priority: VHI Keywords: multiscreen
Version: 5.27.4   
Target Milestone: 1.0   
Platform: Gentoo Packages   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=433867
https://bugs.kde.org/show_bug.cgi?id=481807
https://bugs.kde.org/show_bug.cgi?id=471045
https://bugs.kde.org/show_bug.cgi?id=472137
https://bugs.kde.org/show_bug.cgi?id=449069
https://bugs.kde.org/show_bug.cgi?id=453314
https://bugs.kde.org/show_bug.cgi?id=493569
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: 0001-tmp.patch
debug.filtered.log

Description i.Dark_Templar 2023-04-15 21:45:04 UTC
SUMMARY
When switching between laptop and external screen with different resolutions, icon positions are reset. Tested with X11, not tested with wayland. In my case laptop screen is 1920x1080 and external display uses 2560x1440.

STEPS TO REPRODUCE
1. Have a laptop with attached external display
2. Run Plasma/X11
3. Ensure only laptop display is enabled, and external display is disabled, or other way around.
4. Arrange icons in non-default way on laptop display
5. Switch to external display only, laptop display should become disabled
6. Arrange icons in non-default way on external display
7. Ensure that screen resolution on external display doesn't match screen resolution of laptop display
8. Switch back to laptop-only display.
9. Switch once more to external display only.

OBSERVED RESULT
On steps 8 and 9 icon positions are reset.

EXPECTED RESULT
On steps 8 and 9 icon positions should be kept how they're previously arranged.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Gentoo Linux
(available in About System)
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

$ xrandr
Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 16384 x 16384
VGA-0 disconnected (normal left inverted right x axis y axis)
LVDS-0 connected (normal left inverted right x axis y axis)
   1920x1080     60.00 +  50.00  
DP-0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 700mm x 390mm
   3840x2160     59.94 +  29.97    23.98  
   2560x1440     59.95* 
   1920x1080    119.88    60.00    59.94    50.00  
   1680x1050     59.95  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768     119.99    75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)
Comment 1 i.Dark_Templar 2023-04-15 21:45:50 UTC
Created attachment 158136 [details]
0001-tmp.patch

Patch adding additional debugging information I used.
Comment 2 i.Dark_Templar 2023-04-15 21:48:24 UTC
Created attachment 158137 [details]
debug.filtered.log

Output of plasma when built with previously attached patch. Moments I consider important:

PLASMADESKTOPDEBUG: Positioner::sourceDataChanged((37,0), (37,0))
PLASMADESKTOPDEBUG: Positioner::sourceRowsAboutToBeRemoved((-1, -1), 0, 42)
PLASMADESKTOPDEBUG: Positioner::setPerStripe(18)
PLASMADESKTOPDEBUG: Enter: Positioner::applyPositions
...
PLASMADESKTOPDEBUG: Exit:  Positioner::applyPositions
PLASMADESKTOPDEBUG: Positioner::setPerStripe(19)
PLASMADESKTOPDEBUG: Positioner::sourceRowsAboutToBeInserted((-1, -1), 0, 42)

So, I assume when plasma switches to different display with different resolution, it first removes all columns and rows, and then inserts new ones, and resets icon positions while doing so.
Comment 3 Nate Graham 2023-04-18 15:33:08 UTC
Can reproduce the issue exactly with those steps on Wayland too, if I ensure that the screens have different logical resolutions.
Comment 4 Sollace 2024-01-28 13:59:54 UTC
I'm having this same problem with the following setup under Wayland:

Setup A:
Monitor 1 (external primary): 2560x1440@125%
Monitor 2 (external): 2560x1440@125%
Monitor 3 (internal): disabled

Setup B:
Monitor 3 (internal): 3840x2160@200%

I thought initially I could prevent the problem by reducing the display scale on monitor 3 to make it larger than the external ones, but that seems to be of questionable effectiveness when actually switching. I do notice that the problem goes away so long as monitor 3 is enabled before switching to it fully.

So when switching to using the laptop screen you have to:
1. Open the laptop (or enable its internal display if it doesn't do so automatically)
2. Unplug the other external monitors

Then when switching to the external monitors:
1. Plug in both monitors (ensure it is configured to extend to use all 3 displays so the internal one remains active)
2. Close the laptop lid which disables the internal display

In essence, so long as the monitor that is to become the new primary display is active and part of the existing arrangement, icons remain where they were originally when last using that display as the primary before. If the destination monitor is inactive at the time of switching, then suddenly it forgets the arrangement and icons become jumbled.

I hope this extra info will be helpful for anyone needing to reproduce this, and for anyone who's perhaps looking for a workaround until the issue can eventually be fixed. :)
Comment 5 Nate Graham 2024-06-28 19:31:27 UTC
Reducing priority pending a bug-triage of all the Folder View bugs so we can prioritize what to fix here.
Comment 6 TraceyC 2024-07-31 23:29:27 UTC
There are multiple bugs describing the same or similar behavior for icon positioning on the desktop not being saved. Since this is the oldest I see, I'll use this as the main one.
While Bug 433867 appears similar, I'm not sure if the root cause is the same. I'll add it as related but keep it open

I tested using the reproduction steps from this report on:
6.1.3 using a laptop and external monitor, Wayland
git-master using another laptop and different external monitor, Wayland

RESULTS
- 6.1.3 
At step 5 the icon positioning is changed so they are all on the same row
At step 7 they are also alphabetized 

- git-master
If I switch to the external display and choose Keep on the confirmation, icon arrangements are kept.
If I switch the external monitor on and the laptop screen off, but let that revert, the previously saved icon configuration is forgotten. The icons are in one row, alphabetized.
If I then rearrange the icons on the laptop display and switch to the external display, that display has the icon arrangement from the laptop display and not the one I last saved on it

If I switch from the external back to the internal, the icons are alphabetized and in one row again


A compiled list of similar bugs from https://bugs.kde.org/show_bug.cgi?id=490891

482875	6	?	Desktop icons reset positions to alphabetical order after a long time from auto shut-off of screen (Wayland)
484806	6	?	Desktop icons rearrange when disconnecting and reconnecting external screen
486528	6	W	Desktop icons being mixed sometimes after a reboot
483770	6	?	Icons position on the desktop get scrambled with multimonitor
482211	6	W	Desktop icons sorted by name were occasionally unsorted when starting Plasma

476928	5	X	Plasma Desktop Icons are regularly scrambled after boot
472137	5	?	Icons are changing positions after some time
471045	5	W	Dolphin 24.02.2 - Plasma 6.04 Wayland is not respecting the positions of the icons on the desktop
469276	5	?	Desktop icons reset positions to alphabetical order at random time when fullscreen app is open
467405	5	?	Desktop Icons that were arranged in a custom order become alphabetically sorted automatically after a period of time
466869	5	X	Desktop icons reset positions after changing screen setup
453314	5	?	When changing display resolutions, desktop icons should try to keep the same position as much as possible

469062	5	W	Moving some icons on primary screen while secondary screen is unplugged resets icon positions on the secondary screen
468546	5	X	Desktop icons reset position when switching between laptop and external displays with different resolutions
433867	5	?	Icons on rotated secondary screen reset to default positions or move to random positions on login/wake-from-sleep
Comment 7 TraceyC 2024-07-31 23:35:02 UTC
*** Bug 482875 has been marked as a duplicate of this bug. ***
Comment 8 TraceyC 2024-07-31 23:35:46 UTC
*** Bug 484806 has been marked as a duplicate of this bug. ***
Comment 9 TraceyC 2024-07-31 23:38:01 UTC
*** Bug 486528 has been marked as a duplicate of this bug. ***
Comment 10 TraceyC 2024-07-31 23:41:11 UTC
*** Bug 469276 has been marked as a duplicate of this bug. ***
Comment 11 TraceyC 2024-07-31 23:42:49 UTC
*** Bug 467405 has been marked as a duplicate of this bug. ***
Comment 12 TraceyC 2024-07-31 23:43:03 UTC
*** Bug 466869 has been marked as a duplicate of this bug. ***
Comment 13 TraceyC 2024-07-31 23:46:09 UTC
*** Bug 490891 has been marked as a duplicate of this bug. ***
Comment 14 TraceyC 2024-08-01 00:16:40 UTC
*** Bug 469062 has been marked as a duplicate of this bug. ***
Comment 15 TraceyC 2024-08-01 00:26:00 UTC
*** Bug 476928 has been marked as a duplicate of this bug. ***
Comment 16 TraceyC 2024-08-01 00:27:53 UTC
*** Bug 482211 has been marked as a duplicate of this bug. ***
Comment 17 TraceyC 2024-08-01 00:30:23 UTC
*** Bug 483770 has been marked as a duplicate of this bug. ***
Comment 18 TraceyC 2024-08-01 00:45:10 UTC
*** Bug 487865 has been marked as a duplicate of this bug. ***
Comment 19 TraceyC 2024-08-01 00:48:47 UTC
*** Bug 474370 has been marked as a duplicate of this bug. ***
Comment 20 cwo 2024-09-18 16:26:08 UTC
*** Bug 487051 has been marked as a duplicate of this bug. ***
Comment 21 Marco Martin 2024-09-30 14:41:54 UTC

*** This bug has been marked as a duplicate of bug 492003 ***
Comment 22 Marco Martin 2024-09-30 14:44:12 UTC
*** Bug 492003 has been marked as a duplicate of this bug. ***
Comment 23 Marco Martin 2024-09-30 14:44:42 UTC
*** Bug 493856 has been marked as a duplicate of this bug. ***
Comment 24 TraceyC 2024-09-30 15:09:50 UTC
Marking confirmed again
Comment 25 Nate Graham 2024-10-02 20:41:40 UTC
This might be fixed in Plasma 6.2 by the changes made to fix Bug 493569; I cannot reproduce it with the original steps anymore. If other folks who were or are experiencing the issue could test again with Plasma 6.2.0 when it's released next week, that would be super awesome. Thanks a lot!

Note that the first time you switch a screen containing icons to a new resolution, the positions all get reset, which is a separate bug (bug 453314). So that's expected right now. But once you're-arrange them, their positions should be remembered after you switch back to the original resolution again, and then to second one.

(also, raising priority to reflect the number of duplicates not)
Comment 26 René Paw Christensen 2024-10-02 21:36:56 UTC
I just upgraded to Plasma 6.2 BETA and Ubuntu Base 24.02 - I will report back if it happens again.
Comment 27 nk0885 2024-10-02 22:10:49 UTC
My configuration :
Screen 0: minimum 8 x 8, current 1680 x 1050, maximum 32767 x 32767
eDP1 connected (normal left inverted right x axis y axis)
   1920x1080     60.02 +  59.93    47.99  
   1680x1050     59.88  
   1400x1050     59.98  
   1600x900      60.00    59.95    59.82  
   1280x1024     76.25    75.02    60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1368x768      60.00    59.88    59.85  
   1280x800      59.81    59.91  
   1280x720      59.86    60.00    59.74  
   1152x768      68.35  
   1024x768      98.16    74.81    60.00    60.00  
   1024x576      60.00    59.90    59.82  
   832x624       74.18  
   960x540       60.00    59.63    59.82  
   800x600      186.01    94.87    60.32    56.25  
   768x576       99.99    79.37  
   864x486       60.00    59.92    59.57  
   640x480      116.65    59.94  
   720x405       59.51    60.00    58.99  
   640x360       59.84    59.32    60.00  
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected primary 1680x1050+0+0 (normal left inverted right x axis y axis) 470mm x 300mm
   1680x1050     59.88*+
   1280x1024     75.02    60.02  
   1440x900      74.98    59.90  
   1280x960      60.00  
   1280x800      74.93    59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
HDMI3 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

The goal : the same on the two screens

Bad Solutions tried : 
xrandr --output eDP1 --mode 1920x1080 --scale 1x1 --output HDMI2 --same-as eDP1 --scale 1.14x1.02

xrandr --output eDP1 --mode 1920x1080 --scale 1x1 --output DP1 --same-as eDP1 --scale 0.87x0.97
xrandr --output DP1 --mode 1680x1020 --output eDP1 -- primary --scale-from 1920x1050

Does not match : Icons are those srambled after

Notice : Till 5 years I have on the desktop 20 icons at specific places . During the boot , when Icon will be scrambled they appear firstly a short time at the good place and suddenly they are scrambled at another place in 80% of the cases at the same wrong places. 
I'm not able to find what is making those changing at that instant in the plasma-org.kde.plasma.desktop-appletsrc file
Comment 28 nk0885 2024-10-02 22:18:17 UTC
Sorry : bad file copy for my screen configuration (it was that one with laptop closed ) 
The correct one is :
Screen 0: minimum 8 x 8, current 1680 x 1050, maximum 32767 x 32767
eDP1 connected primary 1680x1050+0+0 (normal left inverted right x axis y axis) 340mm x 190mm
   1920x1080     60.02 +  59.93    47.99  
   1680x1050     59.88* 
   1400x1050     59.98  
   1600x900      60.00    59.95    59.82  
   1280x1024     76.25    75.02    60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1368x768      60.00    59.88    59.85  
   1280x800      59.81    59.91  
   1280x720      59.86    60.00    59.74  
   1152x768      68.35  
   1024x768      98.16    74.81    60.00    60.00  
   1024x576      60.00    59.90    59.82  
   832x624       74.18  
   960x540       60.00    59.63    59.82  
   800x600      186.01    94.87    60.32    56.25  
   768x576       99.99    79.37  
   864x486       60.00    59.92    59.57  
   640x480      116.65    59.94  
   720x405       59.51    60.00    58.99  
   640x360       59.84    59.32    60.00  
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 470mm x 300mm
   1680x1050     59.88*+
   1280x1024     75.02    60.02  
   1440x900      74.98    59.90  
   1280x960      60.00  
   1280x800      74.93    59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
HDMI3 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
bas
Comment 29 René Paw Christensen 2024-10-03 06:17:01 UTC
> ..... when Icon will be scrambled they appear firstly a short time at the good place and suddenly they are scrambled at another place .....

I see that too when the problem occurs when I logon.

1) KDE logon logo
2) Desktop appear without panels, but with icons in correct place
3) Panels appear, and icons are scrambled, like they are moved down and there are not enough space for them so they are moved
Comment 30 Gábor Katona 2024-10-03 08:52:21 UTC
I am on KDE 6.2 Beta now with openSUSE Tumbleweed. The problem is still present for me.
Comment 31 Nate Graham 2024-10-03 14:06:14 UTC
The change was merged only a few days ago, so it's not in the 6.2 beta. It'll be in the final release of 6.2.0 though (in five days, eek!)
Comment 32 Gábor Katona 2024-10-08 19:29:24 UTC
Just updated to KDE 6.2 on openSUSE Tumbleweed and the issue is still present for me even after several set up icons-disconnect-set up icons- connect cycles.
Comment 33 Gábor Katona 2024-10-08 19:36:02 UTC
But there is progress after more testing. The screen connected to the dock seemed to be good for a while. However when I disconnected the dock, the laptop screen comes up with GOOD icon order, then flickers and the icons become scrambled. 
After touching the icon positions on the laptop screen, now the dock screen is also scrambled. 

There should be still some not defined state when switching screens.
Comment 34 Gábor Katona 2024-10-08 19:46:57 UTC
Sorry for multiply comments. Now I realized, that if I make software switch from external to internal screen (without disconnecting) with different resolution the icons KEEP their position. AND after this physically disconnecting and reconnecting also works. Before the software switch it was almost the same bad, but after a software switch it become stable. 

This is something which still needs fix, because usually people just disconnect. Nevertheless it seems to be a workaround now.
Comment 35 René Paw Christensen 2024-10-09 14:15:20 UTC
I still got the beta logo on my desktop, but System Settings says 2.0.
I have been logging on some times, and so far it works.

1) KDE logon logo
2) Desktop appear without panels, but with icons in correct place
3) Panels appear, and icons are scrambled
4) Icons move back

19 seconds video of the icons scrambling after logon, the difference is that [for now] they return to their proper positions:
https://rpc-scandinavia.dk/api/webpage/GetFileResource/Public/2024-10-09%20KDE%20Neon%20Login.mp4