From 5541098f2026daed21d87fdaa5c85d8329c8cfbc Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 21 Jun 2022 22:47:27 +0200 Subject: [PATCH] Added bindl --- src/config/ConfigManager.cpp | 5 +++-- src/config/ConfigManager.hpp | 2 +- src/managers/KeybindManager.cpp | 8 +++----- src/managers/KeybindManager.hpp | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index b76ab9659..2abbdcc42 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -415,7 +415,7 @@ void CConfigManager::handleAnimation(const std::string& command, const std::stri configSetValueSafe("animations:" + ANIMNAME + "_style", curitem); } -void CConfigManager::handleBind(const std::string& command, const std::string& value) { +void CConfigManager::handleBind(const std::string& command, const std::string& value, bool locked) { // example: // bind=SUPER,G,exec,dmenu_run @@ -448,7 +448,7 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v } if (KEY != "") - g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND}); + g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND, locked}); } void CConfigManager::handleUnbind(const std::string& command, const std::string& value) { @@ -578,6 +578,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std:: } else if (COMMAND == "monitor") handleMonitor(COMMAND, VALUE); else if (COMMAND == "bind") handleBind(COMMAND, VALUE); + else if (COMMAND == "bindl") handleBind(COMMAND, VALUE, true); else if (COMMAND == "unbind") handleUnbind(COMMAND, VALUE); else if (COMMAND == "workspace") handleDefaultWorkspace(COMMAND, VALUE); else if (COMMAND == "windowrule") handleWindowRule(COMMAND, VALUE); diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 0d4386c17..407ccce4c 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -106,7 +106,7 @@ private: void configSetValueSafe(const std::string&, const std::string&); void handleRawExec(const std::string&, const std::string&); void handleMonitor(const std::string&, const std::string&); - void handleBind(const std::string&, const std::string&); + void handleBind(const std::string&, const std::string&, bool locked = false); void handleUnbind(const std::string&, const std::string&); void handleWindowRule(const std::string&, const std::string&); void handleDefaultWorkspace(const std::string&, const std::string&); diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 96d8ce601..17c606b97 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -72,13 +72,11 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t if (handleInternalKeybinds(key)) return true; - if (g_pCompositor->m_sSeat.exclusiveClient){ - Debug::log(LOG, "Not handling keybinds due to there being an exclusive inhibited client."); - return false; - } + if (g_pCompositor->m_sSeat.exclusiveClient) + Debug::log(LOG, "Keybind handling only locked (inhibitor)"); for (auto& k : m_lKeybinds) { - if (modmask != k.modmask) + if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked)) continue; // oMg such performance hit!!11! diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index cb99aa416..a3dbb8dd9 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -11,6 +11,7 @@ struct SKeybind { uint32_t modmask = 0; std::string handler = ""; std::string arg = ""; + bool locked = false; }; class CKeybindManager {