Bug 499341 - Task switcher select the entry at the wrong index if the most recent used window is filtered
Summary: Task switcher select the entry at the wrong index if the most recent used win...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: tabbox (other bugs)
Version First Reported In: 6.2.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-30 19:33 UTC by ariasuni
Modified: 2025-01-31 15:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.3.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ariasuni 2025-01-30 19:33:56 UTC
SUMMARY
In the “Task Switcher” KCM, if I filter windows with “All other screens” (or “All other desktops”) option, then when invoking the task switcher with the shortcut, it’ll often start with the wrong index.

Usually, when using alt+tab, then the first item is the currently focused window, and the second one is selected. However, in case where the currently focused window is filtered, the selected item is incorrect. More precisely, the index of the selected item is equal to the index of the first window appearing in the task switcher if the windows weren’t filtered.

As an example, let’s say I have windows on two different screens:
- screen 1: 1 2 3
- screen 2: 4 5 6
I’ll be using [] to indicate selection in the task switcher tab box.

Case 1: most recently used are 1 4 2 3 5 6
Invoking the task switcher on screen 1 will display 4 [5] 6, instead of the expected [4] 5 6
The index is shifted by one, because without the filter, there would 1 at the top of the list.

Case 2: most recently used are 1 2 4 3 5 6
Invoking the task switcher on screen 1 will display 4 5 [6]
The index is shifted by two, because without the filter, there would 1 and 2 at the top of the list.

Case 3: most recently used are 1 2 3 4 5 6
Invoking the task switcher on screen 1 will display [4] 5 6
The index is shifted by three, causing it to be correct by accident, because without the filter, there would 1, 2 and 3 at the top of the list.

STEPS TO REPRODUCE
1. Use two screens
2. In “Task Switcher” KCM, for one of the task switcher, check “Screens” and select “All other screens”
3. Use the configured task switcher to select a window of the other screen

OBSERVED RESULT
The task switcher very often doesn’t selected the most recently used window matching the settings of the task switcher.

EXPECTED RESULT
The task switcher select the most recently used window matching the settings of the task switcher.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.12.10-zen1-1-zen (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
I’m using alt+tab to switch between the windows of my current screen, and win+tab to switch between the windows of the other screen, so win+tab (in theory) works to select the window on top of the other screen or the other windows if I press again tab while maintaining win, a setup which I’ve found very useful and practical (except for the bug reported here).
Comment 1 ariasuni 2025-01-30 20:04:34 UTC
Investigating the bug and the code further, I realized it may already be fixed in the master branch:
https://invent.kde.org/plasma/kwin/-/merge_requests/6697
Comment 2 Nate Graham 2025-01-31 15:29:45 UTC
Even better, in the Plasma 6.3 branch!