diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-06-22 20:23:20 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-06-22 20:23:20 +0200 |
| commit | 19d94b87ab639a0b22ea03809502316470de0f7a (patch) | |
| tree | b174f738f2794a016f044ac91521aefafad4479b /src/managers/KeybindManager.cpp | |
| parent | bd41776a5aa86cc6294e3ec17ea9b46c9c5780df (diff) | |
Added keybind submaps
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 17c606b9..06075554 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -30,6 +30,7 @@ CKeybindManager::CKeybindManager() { m_mDispatchers["resizeactive"] = resizeActive; m_mDispatchers["cyclenext"] = circleNext; m_mDispatchers["focuswindowbyclass"] = focusWindowByClass; + m_mDispatchers["submap"] = setSubmap; } void CKeybindManager::addKeybind(SKeybind kb) { @@ -76,7 +77,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t Debug::log(LOG, "Keybind handling only locked (inhibitor)"); for (auto& k : m_lKeybinds) { - if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked)) + if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap) continue; // oMg such performance hit!!11! @@ -935,3 +936,21 @@ void CKeybindManager::focusWindowByClass(std::string clazz) { break; } } + +void CKeybindManager::setSubmap(std::string submap) { + if (submap == "reset" || submap == "") { + m_szCurrentSelectedSubmap = ""; + Debug::log(LOG, "Reset active submap to the default one."); + return; + } + + for (auto& k : g_pKeybindManager->m_lKeybinds) { + if (k.submap == submap) { + m_szCurrentSelectedSubmap = submap; + Debug::log(LOG, "Changed keybind submap to %s", submap.c_str()); + return; + } + } + + Debug::log(ERR, "Cannot set submap %s, submap doesn't exist (wasn't registered!)", submap.c_str()); +} |
