diff options
author | normaltaro <[email protected]> | 2024-12-17 21:42:38 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2024-12-17 17:12:38 +0100 |
commit | bd7092a9feb39275a9eb1426046a46671e0fe580 (patch) | |
tree | f55d27a5eb43f44bff48679482aafb697438c0c0 | |
parent | c7d97199103fd1ca43c2a9810c085df5500169ac (diff) | |
download | Hyprland-bd7092a9feb39275a9eb1426046a46671e0fe580.tar.gz Hyprland-bd7092a9feb39275a9eb1426046a46671e0fe580.zip |
binds: cycle within group on single monitor if no window found in the argument direction. (#8714)
-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 {}; } } |