From 6131e0bef71b67b6ba5d1b395da2f3a4c2082551 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 13 Apr 2023 22:20:31 +0100 Subject: [PATCH] keybinds: refocus properly on silent move --- src/managers/KeybindManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index a039f43a..a04f67b9 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1141,7 +1141,12 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { const auto PNEXTCANDIDATE = g_pLayoutManager->getCurrentLayout()->getNextWindowCandidate(PWINDOW); PWINDOW->m_iWorkspaceID = workspaceToMoveTo; - g_pCompositor->focusWindow(PNEXTCANDIDATE); + if (PNEXTCANDIDATE) + g_pCompositor->focusWindow(PNEXTCANDIDATE); + else if (const auto PFIRSTONWS = g_pCompositor->getFirstWindowOnWorkspace(OLDWORKSPACEIDRETURN); PFIRSTONWS) + g_pCompositor->focusWindow(PFIRSTONWS); + else + g_pInputManager->refocus(); } void CKeybindManager::moveFocusTo(std::string args) {