Task switcher: keep sort order constant after switching windows

Hi all! First time poster here!

After returning to Linux I decided to give KDE a try, so far I really like the environment, but I have one major gripe, which I also had in cinnamon a few years ago.

Current situation

Lets say I have four windows open [A, b, c, d] with window A being the active one and b, c and d being inactive. When I alt tab and make window c active, the ordering of the windows in the task switcher turns into [C, a, b, d] and when I then go to d the order becomes [D, c, a, b].

What I am looking for

I would like the order of the windows in the task switcher list to stay the same before and after shifting focus, i.e. with the list [A, b, c, d] I shift my focus to C and get [a, b, C, d]. I then alt tab once and end up with D as the active window and the list looking like [a, b, c, D].

What I have tried

Changing the sort order in the GUI doesn’t do what I want, as the active window still shifts to the start of the list.

I found a this a thread on stack overflow: How do I stop KDE from changing the alt-tab order of minimized windows? (I cannot link it since I am a new user and have some very reasonable limits on what I can do).

Anyway, the stack overflow it lead me to install the kdesrc-build tool as described on the KDE Develper site and building kwin from scratch once to make sure all dependencies were setup correctly. I then tried editing the kde/src/kwin/src/focuschain.cpp file, but after two separate attempts I still can’t figure it out. My background with C++ is however limited to one (bad) class in college 4 years ago so I am not surprised. The changes are mirrored here on github under Herandom/kwin/blob/master/src/focuschain.cpp

The command I used for building was kdesrc-build --no-src --no-include-dependencies kwin.

Final section

Am I completely on the wrong track here? Is there anyone that can give me a pointer in the right direction, or spot any error I made? As I mentioned, C++ is not my strongest language and I mostly just threw some things at the wall, sadly nothing stuck.

As a final note, if anyone is able to help me and we figure this out, I am open to the idea of trying to get this into KDE as an option for all users, though I assume it might be quite an undertaking.

Any help or comments would be greatly appreciated.

2 Likes

Thank you @Herandom for laying this out so neatly. I’m looking for a way to do the exact same thing. Necroing to get some fresh eyes on this request.

1 Like

I’m trying to do the same thing. I was using Sway before and would love to have the same constant window sorting in KDE Plasma.

1 Like

Any update on this? I’m looking for the same

1 Like

I’d like the “stacking order” to follow the order of the apps in the Task Manager.

As it is, I find it confusing and I don’t use it.

I just want short cuts for cycling through the Task Manager. The Task Manager only has “cycle by scrolling” the mouse wheel which I find to be unusable due to not being able to control how much the wheel scrolls before switching to the next window, and it’s of dubious value, as the mouse is already on the taskbar, might as well just click on the window I want than spin the wheel.

1 Like

BUMP. Switched from sway and this is garbage behavior, yes. I wanna switch through an ORDERED set of windows with alt+h and alt+l.

Also, I want to be able to move windows in order with alt+ctrl+h and alt+ctrl+l. current capabilities are limited.

+1000 I fully agree. There should be “Sort order” option like “As listed in Task manager”

Ah I found an open bug for that: https://bugs.kde.org/show_bug.cgi?id=428417