Skip to content

Commit 4dc30eb

Browse files
committed
fix: add xdgTag as a new indicator
1 parent b28fd1a commit 4dc30eb

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/config/ConfigManager.hpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,18 @@ struct SFloatCache {
142142
size_t hash;
143143

144144
SFloatCache(PHLWINDOW window, bool initial) {
145-
if (initial)
146-
hash = std::hash<std::string>{}(window->m_initialClass) ^ (std::hash<std::string>{}(window->m_initialTitle) << 1);
147-
else
148-
hash = std::hash<std::string>{}(window->m_class) ^ (std::hash<std::string>{}(window->m_title) << 1);
145+
// Base hash from class/title
146+
size_t baseHash = initial ? (std::hash<std::string>{}(window->m_initialClass) ^ (std::hash<std::string>{}(window->m_initialTitle) << 1)) :
147+
(std::hash<std::string>{}(window->m_class) ^ (std::hash<std::string>{}(window->m_title) << 1));
148+
149+
// Use empty string as default tag value
150+
std::string tagValue = "";
151+
if (auto xdgTag = window->xdgTag()) {
152+
tagValue = xdgTag.value();
153+
}
154+
155+
// Combine hashes
156+
hash = baseHash ^ (std::hash<std::string>{}(tagValue) << 2);
149157
}
150158

151159
bool operator==(const SFloatCache& other) const {

0 commit comments

Comments
 (0)