diff options
Diffstat (limited to 'desktop/modules/appearance')
| -rw-r--r-- | desktop/modules/appearance/WallpaperSpread.qml | 12 | ||||
| -rw-r--r-- | desktop/modules/appearance/Wallpapers.qml | 32 |
2 files changed, 40 insertions, 4 deletions
diff --git a/desktop/modules/appearance/WallpaperSpread.qml b/desktop/modules/appearance/WallpaperSpread.qml index d1c383d..2f1dd03 100644 --- a/desktop/modules/appearance/WallpaperSpread.qml +++ b/desktop/modules/appearance/WallpaperSpread.qml @@ -73,7 +73,17 @@ Scope { // would pop in late over a half-drawn screen. readonly property bool ready: running && oldImg.status === Image.Ready && newImg.status === Image.Ready - onReadyChanged: if (ready) anim.restart() + onReadyChanged: if (ready) { + anim.restart(); + drawn.restart(); + } + // A few frames for the cover to reach the screen, then wallp may + // swap swaybg underneath it. + Timer { + id: drawn + interval: 50 + onTriggered: Wallpapers.covered() + } // -m fill is a centred crop, which is what PreserveAspectCrop does. Image { diff --git a/desktop/modules/appearance/Wallpapers.qml b/desktop/modules/appearance/Wallpapers.qml index 5507476..4d06a2e 100644 --- a/desktop/modules/appearance/Wallpapers.qml +++ b/desktop/modules/appearance/Wallpapers.qml @@ -244,17 +244,43 @@ Singleton { if (applying || (h === "" && v === "")) return false; applying = true; root.kind = kind; - if (h !== "" && currentH !== "" && h !== currentH) swapping("H", currentH, h); - if (v !== "" && currentV !== "" && v !== currentV) swapping("V", currentV, v); + let covers = 0; + if (h !== "" && currentH !== "" && h !== currentH) { covers++; swapping("H", currentH, h); } + if (v !== "" && currentV !== "" && v !== currentV) { covers++; swapping("V", currentV, v); } const args = []; 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; + uncovered = covers; + if (covers === 0) applyProc.running = true; + else coverWait.restart(); return true; } + // Covers still to come up before wallp may swap swaybg under them. The + // cover decodes its pictures asynchronously, and starting wallp with + // swapping showed the new picture through the still empty cover for a + // moment, then the old one over it, then the burn. WallpaperSpread + // calls covered() once it is drawing; a cover that never comes (a + // screen missing, a picture that fails to load) is waited out. + property int uncovered: 0 + function covered() { + if (uncovered === 0) return; + if (--uncovered === 0) { + coverWait.stop(); + applyProc.running = true; + } + } + Timer { + id: coverWait + interval: 1500 + onTriggered: if (root.uncovered > 0) { + root.uncovered = 0; + applyProc.running = true; + } + } + Process { id: applyProc stderr: StdioCollector { id: applyErr } |
