Skip to content

Commit 11a0d56

Browse files
committed
fix(window): use stored size for new floating window when persistentsize is set. fix hyprwm#9422.
1 parent 2118440 commit 11a0d56

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/layout/IHyprLayout.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,18 @@ void IHyprLayout::requestFocusForWindow(PHLWINDOW pWindow) {
888888
Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // get all rules, see if we have any size overrides.
889889
Vector2D sizeOverride = {};
890890
if (g_pCompositor->m_lastMonitor) {
891+
892+
// If `persistentsize` is set, use the stored size if available.
893+
const bool HASPERSISTENTSIZE =
894+
std::any_of(pWindow->m_matchedRules.begin(), pWindow->m_matchedRules.end(), [](const auto& rule) { return rule->m_ruleType == CWindowRule::RULE_PERSISTENTSIZE; });
895+
896+
const auto STOREDSIZE = HASPERSISTENTSIZE ? g_pConfigManager->getStoredFloatingSize(pWindow) : std::nullopt;
897+
898+
if (STOREDSIZE.has_value()) {
899+
Debug::log(LOG, "using stored size {}x{} for new floating window {}::{}", STOREDSIZE->x, STOREDSIZE->y, pWindow->m_class, pWindow->m_title);
900+
return STOREDSIZE.value();
901+
}
902+
891903
for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
892904
if (r->m_ruleType != CWindowRule::RULE_SIZE)
893905
continue;

0 commit comments

Comments
 (0)