summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.hpp
diff options
context:
space:
mode:
authorJack Barnes <135401840+yuukibarns@users.noreply.github.com>2025-05-06 09:53:43 +0800
committerGitHub <noreply@github.com>2025-05-06 03:53:43 +0200
commit930eeac900c60d147bf26491e15b0727605b3944 (patch)
treef442230ac5b171b2fd404c6a19c0f5c063c4f110 /src/config/ConfigManager.hpp
parentec93f8a1cda30f1cf22a24cbc00f680b8bfd0ba8 (diff)
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
Diffstat (limited to 'src/config/ConfigManager.hpp')
-rw-r--r--src/config/ConfigManager.hpp14
1 files changed, 12 insertions, 2 deletions
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<std::string>{}(window->m_class) ^ (std::hash<std::string>{}(window->m_title) << 1);
+ SFloatCache(PHLWINDOW window, bool initial) {
+ // Base hash from class/title
+ size_t baseHash = initial ? (std::hash<std::string>{}(window->m_initialClass) ^ (std::hash<std::string>{}(window->m_initialTitle) << 1)) :
+ (std::hash<std::string>{}(window->m_class) ^ (std::hash<std::string>{}(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<std::string>{}(tagValue) << 2);
}
bool operator==(const SFloatCache& other) const {