summaryrefslogtreecommitdiff
path: root/src/desktop/rule/windowRule/WindowRule.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-11-17 18:34:02 +0000
committerGitHub <noreply@github.com>2025-11-17 18:34:02 +0000
commitc2670e9ab90bd657e87a1da2c5322e9007dce01f (patch)
treecd033fe3a9b87b1b0d457df043ecc50929ad3c8d /src/desktop/rule/windowRule/WindowRule.hpp
parent95ee08b3403b90e2930d46425cada1d280f3524e (diff)
windowrules: rewrite completely (#12269)
Reworks the window rule syntax completely --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'src/desktop/rule/windowRule/WindowRule.hpp')
-rw-r--r--src/desktop/rule/windowRule/WindowRule.hpp37
1 files changed, 37 insertions, 0 deletions
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 <unordered_set>
+
+namespace Desktop::Rule {
+ constexpr const char* EXEC_RULE_ENV_NAME = "HL_EXEC_RULE_TOKEN";
+
+ std::optional<Vector2D> 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<CWindowRule> buildFromExecString(std::string&&);
+
+ virtual eRuleType type();
+
+ void addEffect(storageType e, const std::string& result);
+ const std::vector<std::pair<storageType, std::string>>& effects();
+ const std::unordered_set<storageType>& effectsSet();
+
+ bool matches(PHLWINDOW w, bool allowEnvLookup = false);
+
+ private:
+ std::vector<std::pair<storageType, std::string>> m_effects;
+ std::unordered_set<storageType> m_effectSet;
+ };
+};