Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/config/WallpaperMatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

#include <algorithm>

// Check if a monitor string represents a wildcard (matches all monitors)
// Empty string or "*" are both treated as wildcards.
// "*" is preferred since hyprlang's special category system doesn't properly
// return entries with empty string keys from listKeysForSpecialCategory().
static bool isWildcard(const std::string& monitor) {
return monitor.empty() || monitor == "*";
}

void CWallpaperMatcher::addState(CConfigManager::SSetting&& s) {
s.id = ++m_maxId;

Expand Down Expand Up @@ -57,13 +65,12 @@ std::optional<CWallpaperMatcher::rw<const CConfigManager::SSetting>> CWallpaperM
for (const auto& s : m_settings) {
if (s.monitor != monName)
continue;

return s;
}

// match wildcard
// match wildcard (empty string or "*")
for (const auto& s : m_settings) {
if (s.monitor.empty())
if (isWildcard(s.monitor))
return s;
}

Expand Down