From 75fded6f11ed645b0e25bf42b05fa57b8a675197 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Tue, 20 Oct 2020 14:05:33 -0600 Subject: [PATCH] Revert "[focuschain/task switcher] Remove special handling for minimized windows" This reverts commit cc862fa674d3407f516a89b8543acea04aa8b37d. It turns out that some people like this behavior and we've received various user complaints about it. --- abstract_client.cpp | 1 + focuschain.cpp | 12 +++++++++++- focuschain.h | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index 35b7fcb61..e44da4725 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -703,6 +703,7 @@ void AbstractClient::minimize(bool avoid_animation) doMinimize(); updateWindowRules(Rules::Minimize); + FocusChain::self()->update(this, FocusChain::MakeFirstMinimized); // TODO: merge signal with s_minimized addWorkspaceRepaint(visibleRect()); emit clientMinimized(this, !avoid_animation); diff --git a/focuschain.cpp b/focuschain.cpp index 66d209709..a68e6d3c6 100644 --- a/focuschain.cpp +++ b/focuschain.cpp @@ -227,7 +227,17 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain) { chain.removeAll(client); - chain.append(client); + if (client->isMinimized()) { // add it before the first minimized ... + for (int i = chain.count()-1; i >= 0; --i) { + if (chain.at(i)->isMinimized()) { + chain.insert(i+1, client); + return; + } + } + chain.prepend(client); // ... or at end of chain + } else { + chain.append(client); + } } void FocusChain::makeLastInChain(AbstractClient *client, Chain &chain) diff --git a/focuschain.h b/focuschain.h index 8baf3ea32..9a7c7e25d 100644 --- a/focuschain.h +++ b/focuschain.h @@ -41,7 +41,8 @@ class FocusChain : public QObject enum Change { MakeFirst, MakeLast, - Update + Update, + MakeFirstMinimized = MakeFirst }; ~FocusChain() override; /**