aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-29 13:10:39 +0100
committerDanilo M. <danix@danix.xyz>2026-10-29 13:10:39 +0100
commita7e7c4ada847f90b2d95e8b0c48618267e6b6e6d (patch)
tree8d340d11db1ac09829085d465090a6cc4f5afd33
parent3d1f4834acded22ba4e75ce0ab0c7456a767eebd (diff)
downloadquickshell-a7e7c4ada847f90b2d95e8b0c48618267e6b6e6d.tar.gz
quickshell-a7e7c4ada847f90b2d95e8b0c48618267e6b6e6d.zip
prefs: the wallpaper engine's settings, lists and homes
The engine needs on/off, an interval, per-screen lists and a home per screen to survive restarts. They live in prefs rather than list files because the lists can be empty, and an empty FileView write writes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--desktop/Prefs.qml23
1 files changed, 22 insertions, 1 deletions
diff --git a/desktop/Prefs.qml b/desktop/Prefs.qml
index 0ed6ee9..9a9b0b7 100644
--- a/desktop/Prefs.qml
+++ b/desktop/Prefs.qml
@@ -50,6 +50,18 @@ Singleton {
readonly property int sidebarMax: 420
property int settingsSidebar: 200
+ // The wallpaper engine (modules/appearance/WallEngine.qml): on or off,
+ // the interval, a list of paths per screen, and each screen's home, the
+ // wallpaper switching off returns to. In here rather than in list files:
+ // the lists can be empty, and an empty FileView write writes nothing.
+ readonly property var wallEngineDefaults: ({ on: false, minutes: 30, h: [], v: [], homeH: "", homeV: "" })
+ property var wallEngine: wallEngineDefaults
+ function setWallEngine(changes) {
+ const w = Object.assign({}, root.wallEngine, changes);
+ root.wallEngine = w;
+ root.write(Object.assign({}, root.doc, { wallEngine: w }));
+ }
+
// The whole parsed object, so a write keeps keys this version does not
// know about.
property var doc: ({})
@@ -103,6 +115,15 @@ Singleton {
const w = parsed.settings ? parsed.settings.sidebar : undefined;
root.settingsSidebar = typeof w === "number" && w >= root.sidebarMin && w <= root.sidebarMax
? Math.round(w) : 200;
+ const we = parsed.wallEngine && typeof parsed.wallEngine === "object" ? parsed.wallEngine : {};
+ const paths = a => Array.isArray(a) ? a.filter(s => typeof s === "string" && s !== "") : [];
+ const str = s => typeof s === "string" ? s : "";
+ root.wallEngine = {
+ on: we.on === true,
+ minutes: Number.isInteger(we.minutes) && we.minutes >= 1 ? we.minutes : 30,
+ h: paths(we.h), v: paths(we.v),
+ homeH: str(we.homeH), homeV: str(we.homeV),
+ };
}
FileView {
@@ -117,6 +138,6 @@ Singleton {
onFileChanged: reload()
onLoaded: root.reparse()
// Missing file: the defaults, and nothing written.
- onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; root.settingsSidebar = 200; root.assistantModel = ""; }
+ onLoadFailed: { root.doc = {}; root.pinnedIp = ""; root.presets = null; root.settingsSidebar = 200; root.assistantModel = ""; root.wallEngine = root.wallEngineDefaults; }
}
}