summaryrefslogtreecommitdiff
path: root/src/config/shared/workspace/WorkspaceRuleManager.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-04-26 15:16:36 +0100
committerGitHub <noreply@github.com>2026-04-26 15:16:36 +0100
commit5ba33f846129f3e6c0505b19f94634b24505e828 (patch)
treeaaacabe678006040c342935481a86607c66607fd /src/config/shared/workspace/WorkspaceRuleManager.cpp
parent329b2b356dd92ac07f4e2aa69cbce82ee9ba9d19 (diff)
config/lua: init lua config manager, use lua if available (#13817)
Adds a new lua config manager, which will automatically be used if there is a lua config present.
Diffstat (limited to 'src/config/shared/workspace/WorkspaceRuleManager.cpp')
-rw-r--r--src/config/shared/workspace/WorkspaceRuleManager.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/config/shared/workspace/WorkspaceRuleManager.cpp b/src/config/shared/workspace/WorkspaceRuleManager.cpp
index ca45873a..4c2c2b90 100644
--- a/src/config/shared/workspace/WorkspaceRuleManager.cpp
+++ b/src/config/shared/workspace/WorkspaceRuleManager.cpp
@@ -22,7 +22,7 @@ void CWorkspaceRuleManager::add(CWorkspaceRule&& x) {
}
void CWorkspaceRuleManager::replaceOrAdd(CWorkspaceRule&& x) {
- auto it = std::ranges::find_if(m_rules, [&x](const auto& r) { return r.m_workspaceString == x.m_workspaceString; });
+ auto it = std::ranges::find_if(m_rules, [&x](const auto& r) { return r.m_enabled && r.m_workspaceString == x.m_workspaceString; });
if (it == m_rules.end())
m_rules.emplace_back(std::move(x));
else
@@ -34,6 +34,9 @@ std::optional<CWorkspaceRule> CWorkspaceRuleManager::getWorkspaceRuleFor(PHLWORK
CWorkspaceRule mergedRule;
for (auto const& rule : m_rules) {
+ if (!rule.m_enabled)
+ continue;
+
if (!workspace->matchesStaticSelector(rule.m_workspaceString))
continue;
@@ -49,6 +52,9 @@ std::optional<CWorkspaceRule> CWorkspaceRuleManager::getWorkspaceRuleFor(PHLWORK
std::string CWorkspaceRuleManager::getDefaultWorkspaceFor(const std::string& name) {
for (auto other = m_rules.begin(); other != m_rules.end(); ++other) {
+ if (!other->m_enabled)
+ continue;
+
if (other->m_isDefault) {
if (other->m_monitor == name)
return other->m_workspaceString;
@@ -72,6 +78,8 @@ PHLMONITOR CWorkspaceRuleManager::getBoundMonitorForWS(const std::string& wsname
std::string CWorkspaceRuleManager::getBoundMonitorStringForWS(const std::string& wsname) {
for (auto const& wr : m_rules) {
+ if (!wr.m_enabled)
+ continue;
const auto WSNAME = wr.m_workspaceName.starts_with("name:") ? wr.m_workspaceName.substr(5) : wr.m_workspaceName;
if (WSNAME == wsname)
return wr.m_monitor;