diff options
author | Vaxry <[email protected]> | 2023-12-11 22:58:40 +0000 |
---|---|---|
committer | Vaxry <[email protected]> | 2023-12-11 22:58:51 +0000 |
commit | ea7569d7e0941d19f5f469a5fbb79bc0fa62b935 (patch) | |
tree | 66cbdeb4cea529b9226f64d3fd4a911f3a1bffbc /src/config | |
parent | e53134ca904e47a24191ea028c019ac9728b7dad (diff) | |
download | Hyprland-ea7569d7e0941d19f5f469a5fbb79bc0fa62b935.tar.gz Hyprland-ea7569d7e0941d19f5f469a5fbb79bc0fa62b935.zip |
config: improve layoutopt handling for workspacerules
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/ConfigManager.cpp | 16 | ||||
-rw-r--r-- | src/config/ConfigManager.hpp | 30 |
2 files changed, 29 insertions, 17 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 5eb26efc..75def1dd 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1227,8 +1227,20 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std: wsRule.isPersistent = configStringToInt(rule.substr(delim + 11)); else if ((delim = rule.find(ruleOnCreatedEmtpy)) != std::string::npos) wsRule.onCreatedEmptyRunCmd = cleanCmdForWorkspace(name, rule.substr(delim + ruleOnCreatedEmtpyLen)); - else if ((delim = rule.find("layoutopt:orientation:")) != std::string::npos) - wsRule.layoutopts["orientation"] = rule.substr(delim + 22); + else if ((delim = rule.find("layoutopt:")) != std::string::npos) { + std::string opt = rule.substr(delim + 10); + if (!opt.contains(":")) { + // invalid + Debug::log(ERR, "Invalid workspace rule found: {}", rule); + parseError = "Invalid workspace rule found: " + rule; + return; + } + + std::string val = opt.substr(opt.find(":") + 1); + opt = opt.substr(0, opt.find(":")); + + wsRule.layoutopts[opt] = val; + } }; size_t pos = 0; diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 8009100e..d5957cd5 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -37,21 +37,21 @@ struct SConfigValue { }; struct SWorkspaceRule { - std::string monitor = ""; - std::string workspaceString = ""; - std::string workspaceName = ""; - int workspaceId = -1; - bool isDefault = false; - bool isPersistent = false; - std::optional<int64_t> gapsIn; - std::optional<int64_t> gapsOut; - std::optional<int64_t> borderSize; - std::optional<int> border; - std::optional<int> rounding; - std::optional<int> decorate; - std::optional<int> shadow; - std::optional<std::string> onCreatedEmptyRunCmd; - std::map<std::string, std::any> layoutopts; + std::string monitor = ""; + std::string workspaceString = ""; + std::string workspaceName = ""; + int workspaceId = -1; + bool isDefault = false; + bool isPersistent = false; + std::optional<int64_t> gapsIn; + std::optional<int64_t> gapsOut; + std::optional<int64_t> borderSize; + std::optional<int> border; + std::optional<int> rounding; + std::optional<int> decorate; + std::optional<int> shadow; + std::optional<std::string> onCreatedEmptyRunCmd; + std::map<std::string, std::string> layoutopts; }; struct SMonitorAdditionalReservedArea { |