From b1686fd4729798f04ddf5980b49ae7f6e40734ce Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 16 Dec 2021 10:53:37 +0100 Subject: [PATCH] Always keep focus on active client when switching activities While finding this to be benficial when working on the activity switcher I think it makes sense in general to keep focus on the current client instead of potentially switching away. --- src/workspace.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/workspace.cpp b/src/workspace.cpp index 5fcae1d03a..2d0b7ff091 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -1161,15 +1161,13 @@ void Workspace::updateCurrentActivity(const QString &new_activity) AbstractClient* c = nullptr; //FIXME below here is a lot of focuschain stuff, probably all wrong now - if (options->focusPolicyIsReasonable()) { + // Keep active client focused if it's on the new activity + if (active_client && active_client->isShown() && active_client->isOnCurrentDesktop() && active_client->isOnCurrentActivity()) { + c = active_client; + } else if (options->focusPolicyIsReasonable()) { // Search in focus chain c = FocusChain::self()->getForActivation(VirtualDesktopManager::self()->currentDesktop()); } - // If "unreasonable focus policy" and active_client is on_all_desktops and - // under mouse (Hence == old_active_client), conserve focus. - // (Thanks to Volker Schatz ) - else if (active_client && active_client->isShown() && active_client->isOnCurrentDesktop() && active_client->isOnCurrentActivity()) - c = active_client; if (!c) c = findDesktop(true, VirtualDesktopManager::self()->currentDesktop());