From feafd0628714ef278fef8670d323963c15d70274 Mon Sep 17 00:00:00 2001 From: John Mylchreest Date: Wed, 7 Jan 2026 15:18:40 +0000 Subject: [PATCH] config: support * as wildcard monitor for default wallpapers (#315) Add isWildcard() helper to treat both empty string and "*" as wildcards when matching wallpaper settings to monitors. This works around a limitation in hyprlang where listKeysForSpecialCategory() skips entries with empty string keys (due to isStatic check in retrieveKeysForCat), causing configs like: wallpaper { monitor = path = /path/to/image.png } to be silently ignored. Users should now use "monitor = *" instead. --- src/config/WallpaperMatcher.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/config/WallpaperMatcher.cpp b/src/config/WallpaperMatcher.cpp index 3e60003..d25658d 100644 --- a/src/config/WallpaperMatcher.cpp +++ b/src/config/WallpaperMatcher.cpp @@ -2,6 +2,14 @@ #include +// 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; @@ -57,13 +65,12 @@ std::optional> 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; }