diff options
| author | Brenno Lemos <brenno@syndel.is> | 2023-10-22 19:11:03 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-22 23:11:03 +0100 |
| commit | b135bd6cd4c27a9fd94dfa084e75188463c2eb3b (patch) | |
| tree | 74f04ca3dd010c41f0fd323187bfd916747da151 /src/config/ConfigManager.cpp | |
| parent | 59f27e7f570170783ac01fb46a0ff90e14de53e6 (diff) | |
workspacerules: Add new optional "default command" for auto-launching apps on new workspaces (#3559)
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index f0961aa0..2ecac5c9 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2,6 +2,7 @@ #include "../managers/KeybindManager.hpp" #include <string.h> +#include <string> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> @@ -1176,7 +1177,10 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std: rules = value.substr(WORKSPACE_DELIM + 1); } - auto assignRule = [&](std::string rule) { + const static std::string ruleOnCreatedEmtpy = "on-created-empty:"; + const static int ruleOnCreatedEmtpyLen = ruleOnCreatedEmtpy.length(); + + auto assignRule = [&](std::string rule) { size_t delim = std::string::npos; if ((delim = rule.find("gapsin:")) != std::string::npos) wsRule.gapsIn = std::stoi(rule.substr(delim + 7)); @@ -1198,6 +1202,8 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std: wsRule.isDefault = configStringToInt(rule.substr(delim + 8)); else if ((delim = rule.find("persistent:")) != std::string::npos) wsRule.isPersistent = configStringToInt(rule.substr(delim + 11)); + else if ((delim = rule.find(ruleOnCreatedEmtpy)) != std::string::npos) + wsRule.onCreatedEmptyRunCmd = cleanCmdForWorkspace(name, rule.substr(delim + ruleOnCreatedEmtpyLen)); }; size_t pos = 0; |
