diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-09 13:26:55 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-09 13:26:55 +0200 |
| commit | 3d5e2c1dc34e1099fd56bad61848f7a48268ea77 (patch) | |
| tree | 352c6faa9f939f3f6b6ae2c793246cf92aa5dfdc /src/managers/KeybindManager.cpp | |
| parent | 7449a0c44c578c1be4de1726349cf6d28d08f31b (diff) | |
Added movefocus dispatcher
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 d820e83e..8cf22892 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -54,6 +54,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t else if (k.handler == "fullscreen") { fullscreenActive(k.arg); } else if (k.handler == "movetoworkspace") { moveActiveToWorkspace(k.arg); } else if (k.handler == "pseudo") { toggleActivePseudo(k.arg); } + else if (k.handler == "movefocus") { moveFocusTo(k.arg); } found = true; } @@ -244,3 +245,22 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) { PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition + g_pCompositor->getMonitorFromID(NEWWORKSPACE->monitorID)->vecPosition; } } + +void CKeybindManager::moveFocusTo(std::string args) { + char arg = args[0]; + + if (arg != 'l' && arg != 'r' && arg != 'u' && arg != 'd' && arg != 't' && arg != 'b') { + Debug::log(ERR, "Cannot move window in direction %c, unsupported direction. Supported: l,r,u/t,d/b", arg); + return; + } + + const auto PLASTWINDOW = g_pCompositor->m_pLastWindow; + + if (!g_pCompositor->windowValidMapped(PLASTWINDOW)) + return; + + const auto PWINDOWTOCHANGETO = g_pCompositor->getWindowInDirection(PLASTWINDOW, arg); + + if (PWINDOWTOCHANGETO) + g_pCompositor->focusWindow(PWINDOWTOCHANGETO); +}
\ No newline at end of file |
