allow wildcards for monitors

This commit is contained in:
vaxerski 2022-11-06 22:56:42 +00:00
parent 1f55dda5e2
commit 6d3a15f33c
2 changed files with 16 additions and 1 deletions

View File

@ -29,7 +29,7 @@ wallpaper = monitor,/path/to/image.png
# .. more monitors
```
Preload will tell Hyprland to load a particular image (supported formats: png, jpg, jpeg). Wallpaper will apply the wallpaper to the selected output (`monitor` is the monitor's name, easily can be retrieved with `hyprctl monitors`)
Preload will tell Hyprland to load a particular image (supported formats: png, jpg, jpeg). Wallpaper will apply the wallpaper to the selected output (`monitor` is the monitor's name, easily can be retrieved with `hyprctl monitors`. You can leave it empty for a wildcard (aka fallback))
You may add `contain:` before the file path in `wallpaper=` to set the mode to contain instead of cover:

View File

@ -261,6 +261,21 @@ void CHyprpaper::ensureMonitorHasActiveWallpaper(SMonitor* pMonitor) {
}
}
if (!it->second) {
// try to find a wildcard
for (auto&[mon, path1] : m_mMonitorActiveWallpapers) {
if (mon.empty()) {
for (auto&[path2, target] : m_mWallpaperTargets) {
if (path1 == path2) {
it->second = ⌖
break;
}
}
break;
}
}
}
if (!it->second) {
pMonitor->hasATarget = false;
Debug::log(WARN, "Monitor %s does not have a target! A wallpaper will not be created.", pMonitor->name.c_str());