diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 35c288ec..799a08e6 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -186,13 +186,15 @@ bool CKeybindManager::tryMoveFocusToMonitor(CMonitor* monitor) { return false; } - const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); - const auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(monitor->activeWorkspace); + const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); + const auto PNEWMAINWORKSPACE = g_pCompositor->getWorkspaceByID(monitor->activeWorkspace); g_pCompositor->setActiveMonitor(monitor); - g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle); - PNEWWORKSPACE->setActive(true); - PNEWWORKSPACE->rememberPrevWorkspace(PWORKSPACE); + g_pCompositor->deactivateAllWLRWorkspaces(PNEWMAINWORKSPACE->m_pWlrHandle); + PNEWMAINWORKSPACE->setActive(true); + PNEWMAINWORKSPACE->rememberPrevWorkspace(PWORKSPACE); + + const auto PNEWWORKSPACE = monitor->specialWorkspaceID != 0 ? g_pCompositor->getWorkspaceByID(monitor->specialWorkspaceID) : PNEWMAINWORKSPACE; const auto PNEWWINDOW = PNEWWORKSPACE->getLastFocusedWindow(); if (PNEWWINDOW) {