diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-07-20 22:33:43 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-07-20 22:33:43 +0200 |
| commit | fc33cae70cab2c5acaeac77e8a5c2594c7292bbd (patch) | |
| tree | 61b44e9f90b4e701e6aa563003d63413d6faed2c /src/config | |
| parent | 641aaff998d6297831b9b139e5ff8767ab5c0c79 (diff) | |
change bind flag parsing
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/ConfigManager.cpp | 19 | ||||
| -rw-r--r-- | src/config/ConfigManager.hpp | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 9d474fcc..fa9a1334 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -506,9 +506,21 @@ 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, bool locked) { +void CConfigManager::handleBind(const std::string& command, const std::string& value) { // example: - // bind=SUPER,G,exec,dmenu_run <args> + // bind[fl]=SUPER,G,exec,dmenu_run <args> + + // flags + bool locked = false; + const auto ARGS = command.substr(4); + for (auto& arg : ARGS) { + if (arg == 'l') { + locked = true; + } else { + parseError = "bind: invalid flag"; + return; + } + } auto valueCopy = value; @@ -710,8 +722,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.find("bind") == 0) handleBind(COMMAND, VALUE); 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 1d281c40..7f51f7e7 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -121,7 +121,7 @@ private: void handleDeviceConfig(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&, bool locked = false); + 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&); |
