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
This commit is contained in:
Jack Barnes 2025-05-06 09:53:43 +08:00 committed by GitHub
parent ec93f8a1cd
commit 930eeac900
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 7 deletions

View file

@ -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 {