diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-21 16:56:27 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-21 16:56:27 +0200 |
| commit | 07080498fd050a6a6660eb68c36d12eb3f87a003 (patch) | |
| tree | fe1c8949b78bce5f97a4e96fd3ec3e277e3d50d7 /src/config/ConfigManager.cpp | |
| parent | b618fc1caa4063bbed8373935db7e00b2f0cc9fe (diff) | |
Added hyprctl keyword
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index db5f5a8a..976c38b5 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -253,6 +253,41 @@ void CConfigManager::handleDefaultWorkspace(const std::string& command, const st } } +std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::string& VALUE, bool dynamic) { + if (dynamic) + parseError = ""; + + if (COMMAND == "exec") { + if (isFirstLaunch) { + firstExecRequests.push_back(VALUE); + } else { + handleRawExec(COMMAND, VALUE); + } + } else if (COMMAND == "exec-once") { + if (isFirstLaunch) { + firstExecRequests.push_back(VALUE); + } + } else if (COMMAND == "monitor") { + handleMonitor(COMMAND, VALUE); + } else if (COMMAND == "bind") { + handleBind(COMMAND, VALUE); + } else if (COMMAND == "workspace") { + handleDefaultWorkspace(COMMAND, VALUE); + } else if (COMMAND == "windowrule") { + handleWindowRule(COMMAND, VALUE); + } else { + configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE); + } + + if (dynamic) { + std::string retval = parseError; + parseError = ""; + return retval; + } + + return parseError; +} + void CConfigManager::parseLine(std::string& line) { // first check if its not a comment const auto COMMENTSTART = line.find_first_of('#'); @@ -298,33 +333,7 @@ void CConfigManager::parseLine(std::string& line) { const auto VALUE = removeBeginEndSpacesTabs(line.substr(EQUALSPLACE + 1)); // - if (COMMAND == "exec") { - if (isFirstLaunch) { - firstExecRequests.push_back(VALUE); - } else { - handleRawExec(COMMAND, VALUE); - } - return; - } else if (COMMAND == "exec-once") { - if (isFirstLaunch) { - firstExecRequests.push_back(VALUE); - } - return; - } else if (COMMAND == "monitor") { - handleMonitor(COMMAND, VALUE); - return; - } else if (COMMAND == "bind") { - handleBind(COMMAND, VALUE); - return; - } else if (COMMAND == "workspace") { - handleDefaultWorkspace(COMMAND, VALUE); - return; - } else if (COMMAND == "windowrule") { - handleWindowRule(COMMAND, VALUE); - return; - } - - configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE); + parseKeyword(COMMAND, VALUE); } void CConfigManager::loadConfigLoadVars() { |
