aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-29 13:10:54 +0100
committerDanilo M. <danix@danix.xyz>2026-10-29 13:10:54 +0100
commita688d52fa711f78e6bb92355177e658a37bcfeba (patch)
tree1b9892f789a1e9c80db2597feedafb908452cbb7 /desktop/modules
parenta7e7c4ada847f90b2d95e8b0c48618267e6b6e6d (diff)
downloadquickshell-a688d52fa711f78e6bb92355177e658a37bcfeba.tar.gz
quickshell-a688d52fa711f78e6bb92355177e658a37bcfeba.zip
wallpaper: one run() for Apply and the engine, with a finished signal
The engine's timer must set wallpapers the same way Apply does so the burn plays. run() is that one path; applied stays Apply's alone (save bar, window close) while finished marks every run's end, which is what the spread overlay now hides on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules')
-rw-r--r--desktop/modules/appearance/WallpaperSpread.qml7
-rw-r--r--desktop/modules/appearance/Wallpapers.qml43
2 files changed, 39 insertions, 11 deletions
diff --git a/desktop/modules/appearance/WallpaperSpread.qml b/desktop/modules/appearance/WallpaperSpread.qml
index c133343..d1c383d 100644
--- a/desktop/modules/appearance/WallpaperSpread.qml
+++ b/desktop/modules/appearance/WallpaperSpread.qml
@@ -59,9 +59,10 @@ Scope {
newImg.source = to;
win.running = true;
}
- // A failed set may have left either picture underneath, so
- // the cover goes at once rather than claiming the new one.
- function onApplied(ok) {
+ // Any run's end, Apply's or the engine's. A failed set may
+ // have left either picture underneath, so the cover goes at
+ // once rather than claiming the new one.
+ function onFinished(ok) {
win.done = true;
if (!ok) win.running = false;
else if (!anim.running) win.running = false;
diff --git a/desktop/modules/appearance/Wallpapers.qml b/desktop/modules/appearance/Wallpapers.qml
index 9e9d4ad..5507476 100644
--- a/desktop/modules/appearance/Wallpapers.qml
+++ b/desktop/modules/appearance/Wallpapers.qml
@@ -60,6 +60,11 @@ Singleton {
// Sent before wallp runs, while current still names the old picture, so
// WallpaperSpread can cover the swap with it.
signal swapping(string which, string from, string to)
+ // Every run's end, Apply's or the engine's. applied is Apply's alone: it
+ // reports to the save bar and closes the window.
+ signal finished(bool ok)
+ // A successful Apply, with what it set ("" for a screen it left).
+ signal manualApplied(string h, string v)
// Sorted by most recent first: the wallpaper wanted now is usually one
// added recently. -maxdepth keeps a stray git checkout from being walked.
@@ -226,24 +231,46 @@ Singleton {
// the new wallpaper exactly as it does from the command line. Both screens
// go in one call: wallp accepts H= and V= together.
function apply() {
- if (applying || !dirty) return;
+ if (dirty) run(pendingH, pendingV, "manual");
+ }
+
+ // What started the run in flight: "manual" (Apply), "tick" (the engine's
+ // timer) or "home" (the engine switched off). A tick is the light run,
+ // UDT_ROTATION, which udt-accent reads; the others are full.
+ property string kind: ""
+
+ // false when nothing was started: a run in flight, or nothing to set.
+ function run(h, v, kind) {
+ if (applying || (h === "" && v === "")) return false;
applying = true;
- if (pendingH !== "" && currentH !== "") swapping("H", currentH, pendingH);
- if (pendingV !== "" && currentV !== "") swapping("V", currentV, pendingV);
+ root.kind = kind;
+ if (h !== "" && currentH !== "" && h !== currentH) swapping("H", currentH, h);
+ if (v !== "" && currentV !== "" && v !== currentV) swapping("V", currentV, v);
const args = [];
- if (pendingH !== "") args.push(`H=${JSON.stringify(pendingH)}`);
- if (pendingV !== "") args.push(`V=${JSON.stringify(pendingV)}`);
- applyProc.command = ["sh", "-c", `wallp --set ${args.join(" ")} >/dev/null 2>&1`];
+ if (h !== "") args.push(`H=${JSON.stringify(h)}`);
+ if (v !== "") args.push(`V=${JSON.stringify(v)}`);
+ const env = kind === "tick" ? "UDT_ROTATION=1 " : "";
+ applyProc.command = ["sh", "-c", `${env}wallp --set ${args.join(" ")} >/dev/null 2>&1`];
applyProc.running = true;
+ return true;
}
Process {
id: applyProc
stderr: StdioCollector { id: applyErr }
onExited: code => {
+ const ok = code === 0;
root.applying = false;
- if (code === 0) root.clearPending();
- root.applied(code === 0, code === 0 ? "" : (applyErr.text.trim() || `wallp exited ${code}`));
+ if (root.kind === "manual") {
+ if (ok) {
+ root.manualApplied(root.pendingH, root.pendingV);
+ root.clearPending();
+ }
+ root.applied(ok, ok ? "" : (applyErr.text.trim() || `wallp exited ${code}`));
+ } else if (!ok) {
+ console.warn(`Wallpapers: the engine's ${root.kind} set failed, wallp exited ${code}`);
+ }
+ root.finished(ok);
}
}
}