In Plasma 6.6 the KWin script MinimizeAll (included with Plasma) was extended with new options Minimize all other windows and Minimize all other windows in active screen (https://bugs.kde.org/show_bug.cgi?id=197952):
The script minimizes/un-minimizes all windows besides the currently active one. The active window is still active after any of these two actions.
However, there is some odd interaction of this feature with Krohnkite, which results in the window being active when triggering minimization/un-minimization to no longer be active afterwards. This pretty much makes the new feature useless.
What is interesting is the fact that I have been successfully using the work-in-progress version of this script from https://invent.kde.org/plasma/kwin/-/merge_requests/7538 together with Krohnkite for the past couple of months!
I filed an issue at #15 - Active window erroneously changes when using the new „Minimize all other windows…” feature from Plasma 6.6 - anametologin/Krohnkite - Codeberg.org , attaching both versions of the script.
I hope someone could take a look and find out what changes in the final version (included in Plasma 6.6) made the script not work well together with Krohnkite. Mentioning @luisbocanegra the author of the extended version of MinimizeAll.
I also highly recommend trying out these new “Minimize all other windows…” keyboard shortcuts to anyone using Krohnkite, as this brings using Krohnkite to a whole new level!
This is a follow-up to:
It worked in a previous iteration because I was storing the previously active window in a global variable, but that was told that could cause bugs so it got reverted to restoring the focus to the topmost window according to their stackingOrder
What I suspect is happening is that krohnkite is activating other windows while they are being minimized/restored.
Thanks for taking a look!
Actually, maybe the problem is not the usage of stackingOrder for restoring focus but the fact that this restoration is only being done for “Minimize all windows…” variants and not for “Minimize all other windows…” variants (which I use and I am interested in)?
In the initial version of the script, the restoration took place for all variants (plugins/minimizeall: add AllOthers, ActiveScreen & activate last active (!7538) · Merge requests · Plasma / KWin · GitLab). I have been using this exact version for a couple of months without problems.
I’ve talked briefly with Vlad Zahorodnii about this, and he made a remark that Krohnkite should have no reason to activate windows by itself and should only be concerned with positioning them, leaving window activation to KWin. The thinking, I guess, is that if it works without Krohnkite (and it seems to work), it should work the same with Krohnkite.
If Krohnkite indeed (needlessly?) changes the active window by itself, then the behavior of the original script of restoring the active window could have been working as a fix for the fault in Krohnkite.
Do you have any suggestions how to go about finding out what is going in the interaction between MinimizeAll script nad Krohnkite?
I’m coping below observation from my comment in Krohnkite issue:
It turns out that neither KWin nor „Minimize all other windows…” actions change the active window on their own. This can be easily seen with configuration of two windows A (active) and B side by side as depicted below:
┌──────────────┌───────────────┐
│A (active) │B │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
└──────────────└───────────────┘
- With Krohnkite disabled
Minimizing and un-minimizing (1) window B does not change the active window, thus window A is still active.
- With Krohnkite enabled
Minimizing and un-minimizing (1) window B does change the active window to window B
Is there any rationale for Krohnkite changing the active window to the un-minimized one?
If not then can we assume it is a bug in Krohnkite?
(1) This can be done either using keyboard shortcuts for „Minimize all other windows…” actions or right clicking taskbar entry for window B, choosing More and checking or unchecking Minimize checkbox. Do not minimize window B by clicking on its Minimize button on the window title bar to avoid accidentally activating it.
Yeah that is why the previous one worked, it was masking the krohnkite bug/behavior
Do you have any suggestions how to go about finding out what is going in the interaction between MinimizeAll script nad Krohnkite?
You could take a look at the code and see why is changing the active window, or wait for a response to the Krohnkite issue, I am curious too so I am following that issue.