From 6d3a15f33cedaa8f01b0f96c8d2a1f8de24bbb33 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 6 Nov 2022 22:56:42 +0000 Subject: [PATCH] allow wildcards for monitors --- README.md | 2 +- src/Hyprpaper.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5359788..9c0a71e 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index 7fa3c9e..a610b35 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -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());