diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-08-24 22:01:25 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-08-24 22:01:25 +0200 |
| commit | 6c2175ed525cbdc4bb263afbbcbf464ed091f4cd (patch) | |
| tree | 63439b0b77d0c9bec9cb5461da91cd45c68a9ff8 /src/managers/KeybindManager.cpp | |
| parent | 00ef40dda19c369626da487c00cfa87da0e3b185 (diff) | |
fixes to swapnext logic on dwindle
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index a4ddd809..e3799a7c 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1448,12 +1448,24 @@ void CKeybindManager::swapnext(std::string arg) { const auto PLASTWINDOW = g_pCompositor->m_pLastWindow; + const auto PLASTCYCLED = g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow->m_pLastCycledWindow) && g_pCompositor->m_pLastWindow->m_pLastCycledWindow->m_iWorkspaceID == PLASTWINDOW->m_iWorkspaceID ? g_pCompositor->m_pLastWindow->m_pLastCycledWindow : nullptr; + if (arg == "last" || arg == "l" || arg == "prev" || arg == "p") - toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW); + toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTCYCLED ? PLASTCYCLED : PLASTWINDOW); else - toSwap = g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW); + toSwap = g_pCompositor->getNextWindowOnWorkspace(PLASTCYCLED ? PLASTCYCLED : PLASTWINDOW); + + // sometimes we may come back to ourselves. + if (toSwap == PLASTWINDOW) { + if (arg == "last" || arg == "l" || arg == "prev" || arg == "p") + toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW); + else + toSwap = g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW); + } g_pLayoutManager->getCurrentLayout()->switchWindows(PLASTWINDOW, toSwap); + PLASTWINDOW->m_pLastCycledWindow = toSwap; + g_pCompositor->focusWindow(PLASTWINDOW); } |
