#pragma once #include "../RuleWithEffects.hpp" #include "../../DesktopTypes.hpp" #include "../../types/OverridableVar.hpp" #include "WindowRuleEffectContainer.hpp" #include "../../../config/shared/complex/ComplexDataTypes.hpp" #include "../../../helpers/math/Expression.hpp" #include "../../../helpers/math/Math.hpp" #include #include #include namespace Desktop::Rule { constexpr const char* EXEC_RULE_ENV_NAME = "HL_EXEC_RULE_TOKEN"; struct SFullscreenStateRule { int internal = 0; std::optional client; }; struct SOpacityRule { Types::SAlphaValue alpha; Types::SAlphaValue alphaInactive; Types::SAlphaValue alphaFullscreen; }; struct SBorderColorRule { Config::CGradientValueData active; std::optional inactive; }; using WindowRuleEffectValue = std::variant, SFullscreenStateRule, SOpacityRule, SBorderColorRule, Math::SExpressionVec2>; struct SWindowRuleEffect { using storageType = CWindowRuleEffectContainer::storageType; using valueType = WindowRuleEffectValue; CWindowRuleEffectContainer::storageType key = WINDOW_RULE_EFFECT_NONE; std::string raw; WindowRuleEffectValue value; }; class CWindowRule : public CRuleWithEffects { private: using Base = CRuleWithEffects; using storageType = Base::storageType; public: CWindowRule(const std::string& name = ""); virtual ~CWindowRule() = default; using Base::addEffect; CWindowRule(const CWindowRule&) = default; CWindowRule(CWindowRule&) = default; CWindowRule(CWindowRule&&) = default; static std::expected, std::string> buildFromExecString(std::string&&); std::expected addEffect(storageType e, const Math::SExpressionVec2& expr); bool matches(PHLWINDOW w, bool allowEnvLookup = false); private: std::expected parseEffect(storageType e, const std::string& result) override; }; };