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/config/ConfigManager.hpp | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'src/config/ConfigManager.hpp') diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 7f32be41..599ee8e7 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -13,14 +13,12 @@ #include #include "../helpers/Monitor.hpp" #include "../desktop/Window.hpp" -#include "../desktop/LayerRule.hpp" #include "ConfigDataValues.hpp" #include "../SharedDefs.hpp" #include "../helpers/Color.hpp" #include "../desktop/DesktopTypes.hpp" #include "../helpers/memory/Memory.hpp" -#include "../desktop/WindowRule.hpp" #include "../managers/XWaylandManager.hpp" #include "../managers/KeybindManager.hpp" @@ -68,11 +66,6 @@ struct SPluginVariable { std::string name = ""; }; -struct SExecRequestedRule { - std::string szRule = ""; - uint64_t iPid = 0; -}; - enum eConfigOptionType : uint8_t { CONFIG_OPTION_BOOL = 0, CONFIG_OPTION_INT = 1, /* e.g. 0/1/2*/ @@ -214,7 +207,6 @@ class CConfigManager { bool deviceConfigExplicitlySet(const std::string&, const std::string&); bool deviceConfigExists(const std::string&); Hyprlang::CConfigValue* getConfigValueSafeDevice(const std::string& dev, const std::string& val, const std::string& fallback); - bool shouldBlurLS(const std::string&); void* const* getConfigValuePtr(const std::string&); Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = ""); @@ -229,8 +221,6 @@ class CConfigManager { std::string getBoundMonitorStringForWS(const std::string&); const std::vector& getAllWorkspaceRules(); - std::vector> getMatchingRules(PHLWINDOW, bool dynamic = true, bool shadowExec = false); - std::vector> getMatchingRules(PHLLS); void ensurePersistentWorkspacesPresent(); const std::vector& getAllDescriptions(); @@ -260,8 +250,6 @@ class CConfigManager { SP getAnimationPropertyConfig(const std::string&); - void addExecRule(const SExecRequestedRule&); - void handlePluginLoads(); std::string getErrors(); @@ -274,22 +262,24 @@ class CConfigManager { std::optional handleMonitor(const std::string&, const std::string&); std::optional handleBind(const std::string&, const std::string&); std::optional handleUnbind(const std::string&, const std::string&); - std::optional handleWindowRule(const std::string&, const std::string&); - std::optional handleLayerRule(const std::string&, const std::string&); std::optional handleWorkspaceRules(const std::string&, const std::string&); std::optional handleBezier(const std::string&, const std::string&); std::optional handleAnimation(const std::string&, const std::string&); std::optional handleSource(const std::string&, const std::string&); std::optional handleSubmap(const std::string&, const std::string&); - std::optional handleBlurLS(const std::string&, const std::string&); std::optional handleBindWS(const std::string&, const std::string&); std::optional handleEnv(const std::string&, const std::string&); std::optional handlePlugin(const std::string&, const std::string&); std::optional handlePermission(const std::string&, const std::string&); std::optional handleGesture(const std::string&, const std::string&); + std::optional handleWindowrule(const std::string&, const std::string&); + std::optional handleLayerrule(const std::string&, const std::string&); std::optional handleMonitorv2(const std::string& output); Hyprlang::CParseResult handleMonitorv2(); + std::optional addRuleFromConfigKey(const std::string& name); + std::optional addLayerRuleFromConfigKey(const std::string& name); + Hyprlang::CParseResult reloadRules(); std::string m_configCurrentPath; @@ -310,19 +300,16 @@ class CConfigManager { SSubmap m_currentSubmap; - std::vector m_execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty - std::vector m_declaredPlugins; std::vector m_pluginKeywords; std::vector m_pluginVariables; + std::vector> m_keywordRules; + bool m_isFirstLaunch = true; // For exec-once std::vector m_monitorRules; std::vector m_workspaceRules; - std::vector> m_windowRules; - std::vector> m_layerRules; - std::vector m_blurLSNamespaces; bool m_firstExecDispatched = false; bool m_manualCrashInitiated = false; @@ -336,11 +323,11 @@ class CConfigManager { uint32_t m_configValueNumber = 0; // internal methods - void updateBlurredLS(const std::string&, const bool); void setDefaultAnimationVars(); std::optional resetHLConfig(); std::optional generateConfig(std::string configPath); std::optional verifyConfigExists(); + void reloadRuleConfigs(); void postConfigReload(const Hyprlang::CParseResult& result); SWorkspaceRule mergeWorkspaceRules(const SWorkspaceRule&, const SWorkspaceRule&); -- cgit v1.2.3