diff options
| author | nyx <nnyyxxxx@protonmail.com> | 2025-03-07 20:12:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-08 02:12:02 +0100 |
| commit | b80b64cd6c913f8c8ac820a1e4ca615a62ff958f (patch) | |
| tree | e6a6eda202efc6e5995245b3d6b8d0fa2650f7ca /src/desktop/Window.cpp | |
| parent | 4082e876d522dc6ed7118d62cdaa729f84c1b755 (diff) | |
windowrules: add option to allow size persistence between app launches (#9422)
Diffstat (limited to 'src/desktop/Window.cpp')
| -rw-r--r-- | src/desktop/Window.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index ceb5eb18..b7a3f8f6 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -791,6 +791,10 @@ void CWindow::applyDynamicRule(const SP<CWindowRule>& r) { } break; } + case CWindowRule::RULE_PERSISTENTSIZE: { + m_sWindowData.persistentSize = CWindowOverridableVar(true, PRIORITY_WINDOW_RULE); + break; + } default: break; } } @@ -1323,6 +1327,11 @@ void CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std:: *m_vRealPosition = m_vRealPosition->goal() + DELTA / 2.0; *m_vRealSize = NEWSIZE; + + if (m_bIsFloating && !m_bIsX11 && std::any_of(m_vMatchedRules.begin(), m_vMatchedRules.end(), [](const auto& r) { return r->ruleType == CWindowRule::RULE_PERSISTENTSIZE; })) { + Debug::log(LOG, "clamped window {}::{} to {}x{} (persistentsize)", m_szClass, m_szTitle, m_vRealSize->value().x, m_vRealSize->value().y); + g_pConfigManager->storeFloatingSize(m_pSelf.lock(), m_vRealSize->value()); + } } bool CWindow::isFullscreen() { |
