From 930eeac900c60d147bf26491e15b0727605b3944 Mon Sep 17 00:00:00 2001 From: Jack Barnes <135401840+yuukibarns@users.noreply.github.com> Date: Tue, 6 May 2025 09:53:43 +0800 Subject: window: use stored size for new floating window when persistentsize is set (#10212) * fix(window): use stored size for new floating window when persistentsize is set. fix hyprwm#9422. * fix: replace `std::any_of` with `std::ranges:any_of` * fix: use initialClass and initialTitle when storing sizes on close * fix: add `xdgTag` as a new indicator * fix: no {} * fix: format with clang-format --- src/config/ConfigManager.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/config/ConfigManager.hpp') diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index eca2bb28..5cb95bac 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -141,8 +141,18 @@ struct SFirstExecRequest { struct SFloatCache { size_t hash; - SFloatCache(PHLWINDOW window) { - hash = std::hash{}(window->m_class) ^ (std::hash{}(window->m_title) << 1); + SFloatCache(PHLWINDOW window, bool initial) { + // Base hash from class/title + size_t baseHash = initial ? (std::hash{}(window->m_initialClass) ^ (std::hash{}(window->m_initialTitle) << 1)) : + (std::hash{}(window->m_class) ^ (std::hash{}(window->m_title) << 1)); + + // Use empty string as default tag value + std::string tagValue = ""; + if (auto xdgTag = window->xdgTag()) + tagValue = xdgTag.value(); + + // Combine hashes + hash = baseHash ^ (std::hash{}(tagValue) << 2); } bool operator==(const SFloatCache& other) const { -- cgit v1.2.3