diff options
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r-- | src/managers/KeybindManager.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index f23f5dc7..fec608f1 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1395,17 +1395,16 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { g_pCompositor->getWindowInDirection(PLASTWINDOW, arg); // Prioritize focus change within groups if the window is a part of it. - if (*PGROUPCYCLE) { - if (!PLASTWINDOW->m_sGroupData.pNextWindow.expired()) { - if (arg == 'l' && PLASTWINDOW != PLASTWINDOW->getGroupHead()) { - PLASTWINDOW->setGroupCurrent(PLASTWINDOW->getGroupPrevious()); - return {}; - } + if (*PGROUPCYCLE && PLASTWINDOW->m_sGroupData.pNextWindow) { + auto isTheOnlyGroupOnWs = !PWINDOWTOCHANGETO && g_pCompositor->m_vMonitors.size() == 1; + if (arg == 'l' && (PLASTWINDOW != PLASTWINDOW->getGroupHead() || isTheOnlyGroupOnWs)) { + PLASTWINDOW->setGroupCurrent(PLASTWINDOW->getGroupPrevious()); + return {}; + } - else if (arg == 'r' && PLASTWINDOW != PLASTWINDOW->getGroupTail()) { - PLASTWINDOW->setGroupCurrent(PLASTWINDOW->m_sGroupData.pNextWindow.lock()); - return {}; - } + else if (arg == 'r' && (PLASTWINDOW != PLASTWINDOW->getGroupTail() || isTheOnlyGroupOnWs)) { + PLASTWINDOW->setGroupCurrent(PLASTWINDOW->m_sGroupData.pNextWindow.lock()); + return {}; } } |