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/layout/IHyprLayout.cpp | |
| parent | 4082e876d522dc6ed7118d62cdaa729f84c1b755 (diff) | |
windowrules: add option to allow size persistence between app launches (#9422)
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
| -rw-r--r-- | src/layout/IHyprLayout.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index e84ffb21..dc6de9e3 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -14,9 +14,17 @@ #include "../managers/HookSystemManager.hpp" void IHyprLayout::onWindowCreated(PHLWINDOW pWindow, eDirection direction) { - CBox desiredGeometry = g_pXWaylandManager->getGeometryForWindow(pWindow); + CBox desiredGeometry = g_pXWaylandManager->getGeometryForWindow(pWindow); - if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) { + const bool HASPERSISTENTSIZE = + std::any_of(pWindow->m_vMatchedRules.begin(), pWindow->m_vMatchedRules.end(), [](const auto& rule) { return rule->ruleType == CWindowRule::RULE_PERSISTENTSIZE; }); + + const auto STOREDSIZE = HASPERSISTENTSIZE ? g_pConfigManager->getStoredFloatingSize(pWindow) : std::nullopt; + + if (STOREDSIZE.has_value()) { + Debug::log(LOG, "using stored size {}x{} for new window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_szClass, pWindow->m_szTitle); + pWindow->m_vLastFloatingSize = STOREDSIZE.value(); + } else if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) { const auto PMONITOR = pWindow->m_pMonitor.lock(); pWindow->m_vLastFloatingSize = PMONITOR->vecSize / 2.f; } else |
