windowrules: rewrite completely (#12269)
Reworks the window rule syntax completely --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
This commit is contained in:
parent
95ee08b340
commit
c2670e9ab9
93 changed files with 3574 additions and 2255 deletions
37
src/desktop/rule/windowRule/WindowRule.hpp
Normal file
37
src/desktop/rule/windowRule/WindowRule.hpp
Normal file
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue