summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-10 11:39:06 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-10 11:39:06 +0200
commitc6953329d569f5ab5d73f9d9d86b595e4d204964 (patch)
treee41e76fd6cedd730651d6178ec6d26c7bcb76a61 /src/managers/KeybindManager.cpp
parentc451e13e4fcc68100a89139944b0f8d305f9d8ec (diff)
Added circlenext
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index ba4fa9b8..968b1585 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -26,6 +26,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["togglespecialworkspace"] = toggleSpecialWorkspace;
m_mDispatchers["forcerendererreload"] = forceRendererReload;
m_mDispatchers["resizeactive"] = resizeActive;
+ m_mDispatchers["circlenext"] = circleNext;
}
void CKeybindManager::addKeybind(SKeybind kb) {
@@ -868,4 +869,15 @@ void CKeybindManager::resizeActive(std::string args) {
const int Y = std::stoi(y);
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(Vector2D(X, Y));
-} \ No newline at end of file
+}
+
+void CKeybindManager::circleNext(std::string) {
+ if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow))
+ return;
+
+ g_pCompositor->focusWindow(g_pCompositor->getNextWindowOnWorkspace(g_pCompositor->m_pLastWindow));
+
+ const auto MIDPOINT = g_pCompositor->m_pLastWindow->m_vRealPosition.goalv() + g_pCompositor->m_pLastWindow->m_vRealSize.goalv() / 2.f;
+
+ wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, MIDPOINT.x, MIDPOINT.y);
+}