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
+11 -2
View File
@@ -25,7 +25,7 @@ PanelWindow {
onTargetChanged:{
if(!shown.source.toString() || Theme.duration===0) {reveal.stop();incoming.source="";shown.source=target;}
else if(target===shown.source.toString()) {reveal.stop();incoming.source="";}
else {reveal.stop();progress=0;incoming.source=target;}
else {reveal.stop();progress=0;WallpaperService.revealLoading(modelData.name);incoming.source=target;}
}
Component.onCompleted:shown.source=target
function settle() {
@@ -64,7 +64,10 @@ PanelWindow {
fillMode:Image.PreserveAspectCrop
// Settles from a slight zoom while the circle widens, like swww/awww "grow".
scale:1.06-0.06*root.progress
onStatusChanged:if(status===Image.Ready && source.toString())reveal.restart()
onStatusChanged:{
if(status===Image.Ready && source.toString())WallpaperService.revealReady(root.modelData.name);
else if(status===Image.Error)incoming.source="";
}
layer.enabled:root.transitioning
layer.effect:MultiEffect {
maskEnabled:true
@@ -73,6 +76,12 @@ PanelWindow {
maskSpreadAtMin:1
}
}
Connections {
target:WallpaperService
function onRevealSerialChanged() {
if(incoming.status===Image.Ready && incoming.source.toString() && !reveal.running && root.progress===0)reveal.restart();
}
}
NumberAnimation {
id:reveal
target:root;property:"progress"