Switch native wallpapers on all outputs at once with a shared reveal

Skip the provider helper for native rendering (its awww probe alone took
~0.5s per output), write every output in one go, and start each output's
reveal together once all have decoded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-10-13 15:48:43 +02:00
1 parent f6732dc3da
commit 1a2aba82b0
2 files changed
+62 -6

No files matched your search

+51 -4
View File
@@ -53,6 +53,18 @@ Singleton {
if (!ConfigService.ready || !ConfigService.writable || !outputs.length || !outputs[0] || busy)
return false;
error = "";
// Native rendering needs no provider round trip: decode once, then switch
// every output in one write so their transitions start together.
if (backend === "native" && ["native", "auto"].includes(ConfigService.data.wallpaper.backend)) {
const url = "file://" + encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F");
nativePending = {
request: {monitors: outputs},
result: {backend: "native", path: path, providerPath: path, url: url}
};
decodeCheck.source = "";
decodeCheck.source = url;
return true;
}
queue = outputs.slice(1).map(name => ({
path: path,
monitor: name
@@ -116,18 +128,53 @@ Singleton {
}
}
function finishApply(request,result) {
const monitors = request.monitors || [request.monitor];
const next = Object.assign({}, ConfigService.data.wallpaper.byMonitor);
next[request.monitor] = result.path;
ConfigService.setValue("wallpaper.byMonitor", next);
const providerPaths = Object.assign({}, ConfigService.data.wallpaper.providerPaths);
providerPaths[request.monitor] = result.providerPath;
for (const name of monitors) {
next[name] = result.path;
providerPaths[name] = result.providerPath;
}
ConfigService.setValue("wallpaper.byMonitor", next);
ConfigService.setValue("wallpaper.providerPaths", providerPaths);
root.backend = result.backend;
root.changed(request.monitor, result.path);
for (const name of monitors)
root.changed(name, result.path);
root.error = "";
ConfigService.setValue("wallpaper.history",[result.path].concat(ConfigService.data.wallpaper.history.filter(p=>p!==result.path)).slice(0,50));
Qt.callLater(root.applyNext);
}
// Native backgrounds report when their new image has decoded; the reveal
// starts on every output together once all of them are ready.
property var revealWaiting: ({})
property int revealSerial: 0
function revealLoading(output) {
const next = Object.assign({}, revealWaiting);
next[output] = false;
revealWaiting = next;
revealFallback.restart();
}
function revealReady(output) {
// Arrived after the fallback already started the others: go now.
if (!(output in revealWaiting))
return void revealSerial++;
const next = Object.assign({}, revealWaiting);
next[output] = true;
revealWaiting = next;
if (Object.keys(next).every(k => next[k]))
startReveal();
}
function startReveal() {
revealFallback.stop();
revealWaiting = {};
revealSerial++;
}
// A stalled output must not hold the others back for long.
Timer {
id: revealFallback
interval: 400
onTriggered: root.startReveal()
}
// Confirms a native wallpaper decodes before it is saved; set imperatively by applyJob.
Image {
id: decodeCheck