diff options
author | vaxerski <[email protected]> | 2022-08-24 21:40:36 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-08-24 21:40:36 +0200 |
commit | 9c3aeda9f987cf08886026c8f8b487c2f70f134b (patch) | |
tree | 7bec5fb28d0193c45bdb931713692572e3a407a2 | |
parent | ffaf14c19ecc324693315b5334025e055022ad36 (diff) | |
download | Hyprland-9c3aeda9f987cf08886026c8f8b487c2f70f134b.tar.gz Hyprland-9c3aeda9f987cf08886026c8f8b487c2f70f134b.zip |
added swapnext
-rw-r--r-- | src/managers/KeybindManager.cpp | 20 | ||||
-rw-r--r-- | src/managers/KeybindManager.hpp | 1 |
2 files changed, 21 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); +} diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index 29ebc7a1..2462f7a3 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -107,6 +107,7 @@ private: static void layoutmsg(std::string); static void toggleOpaque(std::string); static void dpms(std::string); + static void swapnext(std::string); friend class CCompositor; friend class CInputManager; |