From 758cf90ea1066eea361a9d8c347e7fcf40f6636f Mon Sep 17 00:00:00 2001 From: thejch <66577496+thejch@users.noreply.github.com> Date: Sat, 2 Dec 2023 06:42:49 -0800 Subject: workspacerules: Add workspace rule for master layout orientation (#3964) * add workspace rule for master layout orientation * change rule format * edit rule name * use map for layoutopts * use std::any instead of string --- src/config/ConfigManager.cpp | 2 ++ src/config/ConfigManager.hpp | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src/config') diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 257446ee..5659667e 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1214,6 +1214,8 @@ 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); }; size_t pos = 0; diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index f89ae72c..8009100e 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -37,20 +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 gapsIn; - std::optional gapsOut; - std::optional borderSize; - std::optional border; - std::optional rounding; - std::optional decorate; - std::optional shadow; - std::optional onCreatedEmptyRunCmd; + std::string monitor = ""; + std::string workspaceString = ""; + std::string workspaceName = ""; + int workspaceId = -1; + bool isDefault = false; + bool isPersistent = false; + std::optional gapsIn; + std::optional gapsOut; + std::optional borderSize; + std::optional border; + std::optional rounding; + std::optional decorate; + std::optional shadow; + std::optional onCreatedEmptyRunCmd; + std::map layoutopts; }; struct SMonitorAdditionalReservedArea { -- cgit v1.2.3