diff options
| author | Niklas Haas <github-daiK1o@haasn.dev> | 2024-02-14 18:58:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-14 17:58:28 +0000 |
| commit | d5950f7719d3c9ec5305208265366df5ce81b6c3 (patch) | |
| tree | 266ce4c88f113b3b77601ce16cbf16f615411a25 /src/managers/KeybindManager.cpp | |
| parent | 06087914807f88d2a9fc76c8108985f6327598de (diff) | |
dwindle: add swapsplit dispatcher (#4702)
This is distinct from `swapwindow` in that it allows swapping the entire
tree node with its neighbour.
Fixes: https://github.com/hyprwm/Hyprland/issues/4701
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index db6bbbbc..8e7418fb 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -39,6 +39,7 @@ CKeybindManager::CKeybindManager() { m_mDispatchers["changegroupactive"] = changeGroupActive; m_mDispatchers["movegroupwindow"] = moveGroupWindow; m_mDispatchers["togglesplit"] = toggleSplit; + m_mDispatchers["swapsplit"] = swapSplit; m_mDispatchers["splitratio"] = alterSplitRatio; m_mDispatchers["focusmonitor"] = focusMonitor; m_mDispatchers["movecursortocorner"] = moveCursorToCorner; @@ -1286,6 +1287,21 @@ void CKeybindManager::toggleSplit(std::string args) { g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "togglesplit"); } +void CKeybindManager::swapSplit(std::string args) { + SLayoutMessageHeader header; + header.pWindow = g_pCompositor->m_pLastWindow; + + if (!header.pWindow) + return; + + const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(header.pWindow->m_iWorkspaceID); + + if (PWORKSPACE->m_bHasFullscreenWindow) + return; + + g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "swapsplit"); +} + void CKeybindManager::alterSplitRatio(std::string args) { std::optional<float> splitResult; bool exact = false; |
