mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2024-08-17 06:50:30 +03:00
internal: allow desc: for monitors
This commit is contained in:
parent
3bfaac09f5
commit
66b3ba8d9f
@ -39,7 +39,7 @@ wallpaper = monitor2,/path/to/next_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`. You can leave it empty for a wildcard (aka fallback))
|
||||
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 can also use `desc:` followed by the monitor's description without the (PORT) at the end)
|
||||
|
||||
You may add `contain:` before the file path in `wallpaper=` to set the mode to contain instead of cover:
|
||||
|
||||
|
@ -184,7 +184,17 @@ void CHyprpaper::removeOldHyprpaperImages() {
|
||||
}
|
||||
|
||||
SMonitor* CHyprpaper::getMonitorFromName(const std::string& monname) {
|
||||
bool useDesc = false;
|
||||
std::string desc = "";
|
||||
if (monname.find("desc:") == 0) {
|
||||
useDesc = true;
|
||||
desc = monname.substr(5);
|
||||
}
|
||||
|
||||
for (auto& m : m_vMonitors) {
|
||||
if (useDesc && m->description.find(desc) == 0)
|
||||
return m.get();
|
||||
|
||||
if (m->name == monname)
|
||||
return m.get();
|
||||
}
|
||||
@ -270,6 +280,21 @@ void CHyprpaper::ensureMonitorHasActiveWallpaper(SMonitor* pMonitor) {
|
||||
return; // has
|
||||
|
||||
// get the target
|
||||
for (auto& [mon, path1] : m_mMonitorActiveWallpapers) {
|
||||
if (mon.find("desc:") != 0)
|
||||
continue;
|
||||
|
||||
if (pMonitor->description.find(mon.substr(5)) == 0) {
|
||||
for (auto& [path2, target] : m_mWallpaperTargets) {
|
||||
if (path1 == path2) {
|
||||
it->second = ⌖
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& [mon, path1] : m_mMonitorActiveWallpapers) {
|
||||
if (mon == pMonitor->name) {
|
||||
for (auto& [path2, target] : m_mWallpaperTargets) {
|
||||
|
@ -32,7 +32,9 @@ void Events::name(void *data, wl_output *wl_output, const char *name) {
|
||||
}
|
||||
|
||||
void Events::description(void *data, wl_output *wl_output, const char *description) {
|
||||
// i do not care
|
||||
const auto PMONITOR = (SMonitor*)data;
|
||||
|
||||
PMONITOR->description = description;
|
||||
}
|
||||
|
||||
void Events::handleCapabilities(void *data, wl_seat *wl_seat, uint32_t capabilities) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
struct SMonitor {
|
||||
std::string name = "";
|
||||
std::string description = "";
|
||||
wl_output* output = nullptr;
|
||||
uint32_t wayland_name = 0;
|
||||
Vector2D size;
|
||||
|
Loading…
Reference in New Issue
Block a user