diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 8b14e75a..8095b64c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2160,6 +2160,8 @@ std::optional CConfigManager::handleWorkspaceRules(const std::strin 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("defaultName:")) != std::string::npos) + wsRule.defaultName = rule.substr(delim + 12); else if ((delim = rule.find(ruleOnCreatedEmtpy)) != std::string::npos) wsRule.onCreatedEmptyRunCmd = cleanCmdForWorkspace(name, rule.substr(delim + ruleOnCreatedEmtpyLen)); else if ((delim = rule.find("layoutopt:")) != std::string::npos) { diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 48131bdd..fbc61059 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -43,6 +43,7 @@ struct SWorkspaceRule { std::optional decorate; std::optional shadow; std::optional onCreatedEmptyRunCmd; + std::optional defaultName; std::map layoutopts; }; diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp index 53d028d5..ad8ae4ad 100644 --- a/src/helpers/Workspace.cpp +++ b/src/helpers/Workspace.cpp @@ -24,6 +24,10 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) { m_vRenderOffset.registerVar(); m_fAlpha.registerVar(); + const auto RULEFORTHIS = g_pConfigManager->getWorkspaceRuleFor(this); + if (RULEFORTHIS.defaultName.has_value()) + m_szName = RULEFORTHIS.defaultName.value(); + g_pEventManager->postEvent({"createworkspace", m_szName}); EMIT_HOOK_EVENT("createWorkspace", this); }