diff options
| author | Florent Charpentier <114689807+C0Florent@users.noreply.github.com> | 2026-01-22 02:56:51 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-21 15:56:51 +0000 |
| commit | 22fc8136a21676472b232f9462318e16b1d16745 (patch) | |
| tree | eedc1bf29e2a4189e1ed202325e51184dee213ef /src/desktop/rule/windowRule/WindowRuleApplicator.cpp | |
| parent | e7985ca4c4fa6ca0d96a2f303c3f0395d2d27b31 (diff) | |
desktop/windowRule: allow expression in min_size/max_size (#12977)
Diffstat (limited to 'src/desktop/rule/windowRule/WindowRuleApplicator.cpp')
| -rw-r--r-- | src/desktop/rule/windowRule/WindowRuleApplicator.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp index 9a3f4f63..037f8938 100644 --- a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp +++ b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp @@ -265,13 +265,17 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const if (!m_window) break; - const auto VEC = configStringToVector2D(effect); - if (VEC.x < 1 || VEC.y < 1) { + const auto VEC = m_window->calculateExpression(effect); + if (!VEC) { + Log::logger->log(Log::ERR, "failed to parse {} as an expression", effect); + break; + } + if (VEC->x < 1 || VEC->y < 1) { Log::logger->log(Log::ERR, "Invalid size for maxsize"); break; } - m_maxSize.first = Types::COverridableVar(VEC, Types::PRIORITY_WINDOW_RULE); + m_maxSize.first = Types::COverridableVar(*VEC, Types::PRIORITY_WINDOW_RULE); if (*PCLAMP_TILED || m_window->m_isFloating) m_window->clampWindowSize(std::nullopt, m_maxSize.first.value()); @@ -286,13 +290,18 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const if (!m_window) break; - const auto VEC = configStringToVector2D(effect); - if (VEC.x < 1 || VEC.y < 1) { + const auto VEC = m_window->calculateExpression(effect); + if (!VEC) { + Log::logger->log(Log::ERR, "failed to parse {} as an expression", effect); + break; + } + + if (VEC->x < 1 || VEC->y < 1) { Log::logger->log(Log::ERR, "Invalid size for maxsize"); break; } - m_minSize.first = Types::COverridableVar(VEC, Types::PRIORITY_WINDOW_RULE); + m_minSize.first = Types::COverridableVar(*VEC, Types::PRIORITY_WINDOW_RULE); if (*PCLAMP_TILED || m_window->m_isFloating) m_window->clampWindowSize(m_minSize.first.value(), std::nullopt); } catch (std::exception& e) { Log::logger->log(Log::ERR, "minsize rule \"{}\" failed with: {}", effect, e.what()); } |
