From c2670e9ab90bd657e87a1da2c5322e9007dce01f Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Mon, 17 Nov 2025 18:34:02 +0000 Subject: windowrules: rewrite completely (#12269) Reworks the window rule syntax completely --------- Co-authored-by: Mihai Fufezan --- src/desktop/rule/windowRule/WindowRule.hpp | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/desktop/rule/windowRule/WindowRule.hpp (limited to 'src/desktop/rule/windowRule/WindowRule.hpp') diff --git a/src/desktop/rule/windowRule/WindowRule.hpp b/src/desktop/rule/windowRule/WindowRule.hpp new file mode 100644 index 00000000..944614ce --- /dev/null +++ b/src/desktop/rule/windowRule/WindowRule.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "../Rule.hpp" +#include "../../DesktopTypes.hpp" +#include "WindowRuleEffectContainer.hpp" +#include "../../../helpers/math/Math.hpp" + +#include + +namespace Desktop::Rule { + constexpr const char* EXEC_RULE_ENV_NAME = "HL_EXEC_RULE_TOKEN"; + + std::optional parseRelativeVector(PHLWINDOW w, const std::string& s); + + class CWindowRule : public IRule { + private: + using storageType = CWindowRuleEffectContainer::storageType; + + public: + CWindowRule(const std::string& name = ""); + virtual ~CWindowRule() = default; + + static SP buildFromExecString(std::string&&); + + virtual eRuleType type(); + + void addEffect(storageType e, const std::string& result); + const std::vector>& effects(); + const std::unordered_set& effectsSet(); + + bool matches(PHLWINDOW w, bool allowEnvLookup = false); + + private: + std::vector> m_effects; + std::unordered_set m_effectSet; + }; +}; -- cgit v1.2.3