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:
1 parent
f6732dc3da
commit
1a2aba82b0
2 files changed
+62
-6
No files matched your search
@@ -53,6 +53,18 @@ Singleton {
|
|||||||
if (!ConfigService.ready || !ConfigService.writable || !outputs.length || !outputs[0] || busy)
|
if (!ConfigService.ready || !ConfigService.writable || !outputs.length || !outputs[0] || busy)
|
||||||
return false;
|
return false;
|
||||||
error = "";
|
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 => ({
|
queue = outputs.slice(1).map(name => ({
|
||||||
path: path,
|
path: path,
|
||||||
monitor: name
|
monitor: name
|
||||||
@@ -116,18 +128,53 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function finishApply(request,result) {
|
function finishApply(request,result) {
|
||||||
|
const monitors = request.monitors || [request.monitor];
|
||||||
const next = Object.assign({}, ConfigService.data.wallpaper.byMonitor);
|
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);
|
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);
|
ConfigService.setValue("wallpaper.providerPaths", providerPaths);
|
||||||
root.backend = result.backend;
|
root.backend = result.backend;
|
||||||
root.changed(request.monitor, result.path);
|
for (const name of monitors)
|
||||||
|
root.changed(name, result.path);
|
||||||
root.error = "";
|
root.error = "";
|
||||||
ConfigService.setValue("wallpaper.history",[result.path].concat(ConfigService.data.wallpaper.history.filter(p=>p!==result.path)).slice(0,50));
|
ConfigService.setValue("wallpaper.history",[result.path].concat(ConfigService.data.wallpaper.history.filter(p=>p!==result.path)).slice(0,50));
|
||||||
Qt.callLater(root.applyNext);
|
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.
|
// Confirms a native wallpaper decodes before it is saved; set imperatively by applyJob.
|
||||||
Image {
|
Image {
|
||||||
id: decodeCheck
|
id: decodeCheck
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ PanelWindow {
|
|||||||
onTargetChanged:{
|
onTargetChanged:{
|
||||||
if(!shown.source.toString() || Theme.duration===0) {reveal.stop();incoming.source="";shown.source=target;}
|
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 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
|
Component.onCompleted:shown.source=target
|
||||||
function settle() {
|
function settle() {
|
||||||
@@ -64,7 +64,10 @@ PanelWindow {
|
|||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
// Settles from a slight zoom while the circle widens, like swww/awww "grow".
|
// Settles from a slight zoom while the circle widens, like swww/awww "grow".
|
||||||
scale:1.06-0.06*root.progress
|
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.enabled:root.transitioning
|
||||||
layer.effect:MultiEffect {
|
layer.effect:MultiEffect {
|
||||||
maskEnabled:true
|
maskEnabled:true
|
||||||
@@ -73,6 +76,12 @@ PanelWindow {
|
|||||||
maskSpreadAtMin:1
|
maskSpreadAtMin:1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Connections {
|
||||||
|
target:WallpaperService
|
||||||
|
function onRevealSerialChanged() {
|
||||||
|
if(incoming.status===Image.Ready && incoming.source.toString() && !reveal.running && root.progress===0)reveal.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id:reveal
|
id:reveal
|
||||||
target:root;property:"progress"
|
target:root;property:"progress"
|
||||||
|
|||||||
Reference in new issue
Block a user