diff options
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index b1b51dd7..75660304 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -39,6 +39,7 @@ CKeybindManager::CKeybindManager() { m_mDispatchers["dpms"] = dpms; m_mDispatchers["movewindowpixel"] = moveWindow; m_mDispatchers["resizewindowpixel"] = resizeWindow; + m_mDispatchers["swapnext"] = swapNext; m_tScrollTimer.reset(); } @@ -1437,3 +1438,22 @@ void CKeybindManager::dpms(std::string arg) { g_pCompositor->m_bDPMSStateON = enable; } + +void CKeybindManager::swapnext(std::string arg) { + + CWindow* toSwap = nullptr; + + if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow)) + return; + + const auto PLASTWINDOW = g_pCompositor->m_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); + + g_pCompositor->focusWindow(PLASTWINDOW); +} |
