aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMightyPlaza <[email protected]>2023-07-18 22:30:10 +0000
committerGitHub <[email protected]>2023-07-19 00:30:10 +0200
commit3b035977843f14410b3e3985ddee566f1bd29ad0 (patch)
tree30163b0af6839733eea814d90932381fecde178f
parentce9c5fd7227d6f90a103a0ae379b61a429a9f572 (diff)
downloadHyprland-3b035977843f14410b3e3985ddee566f1bd29ad0.tar.gz
Hyprland-3b035977843f14410b3e3985ddee566f1bd29ad0.zip
keybinds: movegroupwindow-improvement (#2740)
* movegroupwindow-improvement * use std::swap
-rw-r--r--src/managers/KeybindManager.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index f86134df..e4c9b50f 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -1013,11 +1013,9 @@ void CKeybindManager::moveFocusTo(std::string args) {
}
};
- const auto PWINDOWTOCHANGETO = PLASTWINDOW->m_bIsFullscreen
- ? (arg == 'd' || arg == 'b' || arg == 'r'
- ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true)
- : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true))
- : g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
+ const auto PWINDOWTOCHANGETO = PLASTWINDOW->m_bIsFullscreen ?
+ (arg == 'd' || arg == 'b' || arg == 'r' ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true) : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true)) :
+ g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
// Found window in direction, switch to it
if (PWINDOWTOCHANGETO) {
@@ -2088,6 +2086,9 @@ void CKeybindManager::moveGroupWindow(std::string args) {
if (!g_pCompositor->m_pLastWindow || !g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow)
return;
- g_pCompositor->m_pLastWindow->switchWithWindowInGroup(BACK ? g_pCompositor->m_pLastWindow->getGroupPrevious() : g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow);
+ if ((!BACK && g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow->m_sGroupData.head) || (BACK && g_pCompositor->m_pLastWindow->m_sGroupData.head))
+ std::swap(g_pCompositor->m_pLastWindow->m_sGroupData.head, g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow->m_sGroupData.head);
+ else
+ g_pCompositor->m_pLastWindow->switchWithWindowInGroup(BACK ? g_pCompositor->m_pLastWindow->getGroupPrevious() : g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow);
g_pCompositor->m_pLastWindow->updateWindowDecos();
}