Bug 462508

Summary: Manual sorting of ungrouped tasks not working when Do not group is selected and Keep launchers separate is disabled
Product: [Plasma] plasmashell Reporter: Stephan Lange <sl077>
Component: Task Manager and Icons-Only Task Manager widgetsAssignee: veggero <niccolo.venerandi>
Status: RESOLVED FIXED    
Severity: minor CC: nate, niccolo.venerandi, qydwhotmail
Priority: NOR Keywords: regression
Version First Reported In: 5.26.3   
Target Milestone: 1.0   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.27
Sentry Crash Report:

Description Stephan Lange 2022-12-01 14:46:25 UTC
SUMMARY
Manual sorting with multiple ungrouped tasks (of the same application) by drag'n'drop only works correctly, if launchers are kept separate.

STEPS TO REPRODUCE
1.  Choose "Task Manager" (Classic taskbar-style window switcher) with "Show Alternatives"
2.  Configure Task Manager -> Behaviour:
2.1.  Group: -> Do not group
2.2.  Sort: -> Manually
2.3.  Keep launchers separate: -> untick (= false)
3.  Open multiple windows:
3.1.  single window of application #1 (e.g. Dolphin)
3.2.  multiple (! >=2) windows of application #2 (e.g. Konsole)
4.  Try to drag Dolphin from start of task list to end or vice versa

OBSERVED RESULT
Dragging one task over the next one switches them both in the task bar, as expected. But if "crossing" more than one  instance of the same application, the dragged task seems to get mixed with one of the other tasks and doesn't end up where it should be. Even worse, the order of the other tasks is messed up after this as well. You don't actually need two different applications for this, but it's more obvious (better to see) if you do.

EXPECTED RESULT
Dragging one task should only move that one to the desired location and never change sorting of any other tasks.

SOFTWARE/OS VERSIONS
This happens with current KDE on Debian Bookworm amd64, I first observed this behaviour a few weeks ago. Trying with a test system and Debian Snapshots, I didn't see this problem with version 4:5.25.90-2, but it did show up with 4:5.26.0-1.

ADDITIONAL INFORMATION
Selecting "Keep launchers separate" (= true) works around this issue for me.
Comment 1 veggero 2022-12-02 11:05:55 UTC
Can confirm with given steps. Again, I'll see if I manage to squash this in the coming days.
Comment 2 Fushan Wen 2022-12-03 14:23:03 UTC
Git commit a5961dfb6e425158f714247e762a0fd3ee6b1b19 by Fushan Wen.
Committed on 03/12/2022 at 14:20.
Pushed by fusionfuture into branch 'master'.

libtaskmanager: check if item before/after is a launcher before moving it

When separateLaunchers is disabled, also check if the item at before/after
the new position is a launcher to avoid moving an actual window.
FIXED-IN: 5.27

M  +7    -3    libtaskmanager/tasksmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/a5961dfb6e425158f714247e762a0fd3ee6b1b19