From a3b37b0191ff5bbf5ccba44944966fff8e8ecd57 Mon Sep 17 00:00:00 2001 From: Julian Schuler <31921487+julianschuler@users.noreply.github.com> Date: Sat, 17 Dec 2022 18:28:43 +0100 Subject: [PATCH] Fix focus not changing on (empty) workspace change (#1243) --- src/managers/KeybindManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index f41f47bf..77db9eca 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -781,6 +781,10 @@ void CKeybindManager::changeworkspace(std::string args) { g_pInputManager->refocus(); } else if (g_pCompositor->getWindowsOnWorkspace(PWORKSPACETOCHANGETO->m_iID) > 0) g_pInputManager->refocus(); + else { + // if there are no windows on the workspace, just unfocus the window on the previous workspace + g_pCompositor->focusWindow(nullptr); + } // set the new monitor as the last (no warps would bug otherwise) g_pCompositor->setActiveMonitor(g_pCompositor->getMonitorFromID(PWORKSPACETOCHANGETO->m_iMonitorID));