diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-21 17:06:43 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-21 17:06:43 +0200 |
| commit | 064e40d25f1265a2d6f00f37c402e5f9e08954aa (patch) | |
| tree | f44186686f565906f3c6a22b94ab4d7573f1267b /src/config | |
| parent | 07080498fd050a6a6660eb68c36d12eb3f87a003 (diff) | |
Added unbind keyword
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/ConfigManager.cpp | 13 | ||||
| -rw-r--r-- | src/config/ConfigManager.hpp | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 976c38b5..e80b545d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -215,6 +215,17 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND}); } +void CConfigManager::handleUnbind(const std::string& command, const std::string& value) { + auto valueCopy = value; + + const auto MOD = g_pKeybindManager->stringToModMask(valueCopy.substr(0, valueCopy.find_first_of(","))); + valueCopy = valueCopy.substr(valueCopy.find_first_of(",") + 1); + + const auto KEY = valueCopy; + + g_pKeybindManager->removeKeybind(MOD, KEY); +} + void CConfigManager::handleWindowRule(const std::string& command, const std::string& value) { const auto RULE = value.substr(0, value.find_first_of(",")); const auto VALUE = value.substr(value.find_first_of(",") + 1); @@ -271,6 +282,8 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std:: handleMonitor(COMMAND, VALUE); } else if (COMMAND == "bind") { handleBind(COMMAND, VALUE); + } else if (COMMAND == "unbind") { + handleUnbind(COMMAND, VALUE); } else if (COMMAND == "workspace") { handleDefaultWorkspace(COMMAND, VALUE); } else if (COMMAND == "windowrule") { diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 2f071a13..4c2c5660 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -86,6 +86,7 @@ private: 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 handleUnbind(const std::string&, const std::string&); void handleWindowRule(const std::string&, const std::string&); void handleDefaultWorkspace(const std::string&, const std::string&); }; |
