From 5ba33f846129f3e6c0505b19f94634b24505e828 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 26 Apr 2026 15:16:36 +0100 Subject: 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. --- src/config/shared/workspace/WorkspaceRuleManager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/config/shared/workspace/WorkspaceRuleManager.cpp') 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 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 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; -- cgit v1.2.3