Skip to content

Background wipe animates on only one output - #10660

Open
sven-strothoff wants to merge 7 commits into
omacom:quattrofrom
sven-strothoff:fix-background-wipe-single-output
Open

sven-strothoff wants to merge 7 commits into
omacom:quattrofrom
sven-strothoff:fix-background-wipe-single-output

Conversation

@sven-strothoff

@sven-strothoff sven-strothoff commented Sep 7, 2026 •

Copy link
Copy Markdown

The desktop background wipe animates on one output only. The other outputs
hold the old wallpaper for the length of the transition and then jump
straight to the new one. Which output animates is not stable — it follows
whichever one wins a decode race, so it usually looks like "the monitor I
made the change on" and moves between runs.

Cause

revealProgress, incomingBackground and backgroundVersion live on the
plugin root and are shared by every panel, so the wipe is meant to run
everywhere. The guard in maybeStartReveal required revealProgress to
still be 0:

if (!root.incomingBackground || root.revealProgress !== 0 || maskReady) return

incomingFrame has cache: false, so each output decodes its own copy of
the image and they finish at different times. The first output to decode
calls startReveal, which starts the animation and moves revealProgress
off 0. Every other output then fails the guard and never sets
maskReady, so its incomingLayer stays invisible until revealProgress
reaches 1.

startReveal already guards the animation restart with
revealStartedVersion === backgroundVersion, so dropping the
revealProgress condition simply lets a late output set its own mask and
pick the front up where it already is.

Verification

No automated test covers this, so I measured it. grim -g samples a
wallpaper-only strip on each output (below the bar and below the lowest
mapped window) while a transition runs, in two parallel loops, counting
distinct frames. An output that wipes produces a run of distinct frames;
one that snaps produces two — the old wallpaper and the new one.

At the shipped 420ms duration, 40 samples per output, 6 runs each:

eDP-1 DP-12
quattro 2 distinct in 5 of 6 runs 7-9
this PR 6-9 every run 6-9 every run

Slowed to a 4s reveal so the sampling window covers the whole animation,
30 samples per output, 10 runs each, counting runs in which an output
produced a single distinct frame — i.e. never changed at all:

tree collapses
quattro 2/10
this PR 0/10

Setup: Hyprland, Qt 6.11.2, Quickshell 0.3.1, two outputs side by side at
scale 1.6 — eDP-1 at 0,0 (2400x1500 logical) and DP-12 at 2400,0
(2400x1350 logical).

Reproducing it reliably: decode cold

Worth knowing before anyone tries to reproduce this, because it is the
difference between the bug firing almost every time and barely firing at
all. The race needs one output to finish decoding after the animation
has already started. Cycling between wallpapers the shell has loaded
before — omarchy theme bg next around a theme's backgrounds, which is
what I did — gives warm decodes that finish close enough together that
both outputs usually make the guard in time. That is why my 4s numbers
above are only 2/10 rather than near-deterministic.

Moving to a wallpaper neither shell has seen before on every transition
makes each output decode cold and the collapse the common case.
@omarchybot ran exactly that on a two-output worker (Virtual-1 at 1280x800
and a headless 1920x1080 at scale 2), reveal slowed to 4s, eight
transitions against each tree:

tree Virtual-1 HEADLESS-1
quattro 2 distinct frames (old and new) in 6 of 8 14-17
this PR 19-21 in 8 of 8 15-17

It also checked the other direction: with two already-seen wallpapers,
quattro wiped on both outputs every time. That asymmetry is the cause
stated directly — warm decodes do not race, cold ones do.

So an intermittent "the wipe works fine here" on a multi-output machine is
expected if the wallpapers are already cached; the recipe above is the one
that shows it.

A correction to this PR's history

This PR originally carried a second commit that replaced the reveal mask's
layer.enabled with a ShaderEffectSource using hideSource, on the
theory that an item with visible: false cannot dirty its window and so
an otherwise-idle output never schedules a frame. That was wrong, and
the commit is reverted here.

@omarchybot isolated the two commits on a two-output worker and found the
guard change alone makes both outputs animate while the mask change alone
changes nothing, and traced Qt 6.11's qtdeclarative to show that a hidden
item with layer.enabled is kept in the scene graph through its effect
reference, still marks the window dirty, and that QQuickShape keeps
syncing a hidden shape holding effect references. I reproduced that
isolation on my own two-output machine and get the same answer: the guard
alone is 0/10 collapses, the mask change alone behaves like quattro.

I should not have shipped that commit. I never measured the guard change
on its own — an early "still only one monitor" observation came from a run
where the patched file had not actually loaded, because a service plugin
is not re-instantiated on hot-reload, and every measurement I ran
afterwards compared stock against both changes rather than isolating
them. The mask change is also not inert: ShaderEffectSource defaults to
smooth: true where layer.smooth defaults to false.

What is left is the two-line guard change.

Tests

./test/all on this branch fails 12 of 290 shell files plus one in
test/cli. I ran the full suite on quattro as well: the same 12 files
fail, with the same 11 not ok lines, so none of them are from this
change. Three want an omarchy-pkgs checkout I do not have,
runtime-smoke-test.sh trips #9975's per-screen IpcHandler assertion
(saw 4 for 2 screen(s), identical on both trees),
video-background-test.sh dies on PREPARED_BACKGROUND_SNAPSHOT: unbound variable before reaching its assertions, and test/cli's single failure
is vscode generated theme references current theme file — the same one
@omarchybot saw fail on quattro on its worker.

(These numbers replace a "5 of 234" figure from when this PR was opened;
the suite has since grown to 290 files and quattro has moved on.)

maybeStartReveal required revealProgress to still be 0, but each output
decodes its own copy of the incoming image and finishes at a different
time. The first output to decode called startReveal, which starts the
animation and moves revealProgress off 0, so every other output failed
the guard and never set maskReady. Its incomingLayer stayed invisible
until revealProgress reached 1, leaving it on the old wallpaper for the
length of the transition and then jumping straight to the new one.

Drop the revealProgress condition. startReveal already restarts the
animation only once per backgroundVersion, so a late output sets its
own mask and picks the front up where it is.
The reveal mask was a visible: false item captured through its own
layer. An item outside the render tree can change its geometry without
dirtying the window, so growing the mask shape scheduled no frame on an
output whose scene was otherwise static. That output kept the old
wallpaper for the whole transition and jumped to the new one when the
reveal finished, while an output that happened to be repainting for
another reason showed the wipe.

Capture the mask through a ShaderEffectSource with hideSource instead.
The mask stays live in the tree, so its geometry changes schedule frames
on every output, and hideSource keeps it off the screen.
@sven-strothoff

Copy link
Copy Markdown
Author

For context, there's a follow-up that builds on this: #10677 (draft, stacked on this branch), discussed in #10678. It is not needed to review or merge this one — these two commits stand on their own as a bug fix, and the follow-up only becomes visible once they land.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
quattro added screen-size decoding just above maybeStartReveal; the conflict was only textual, and both are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and run on an Omarchy worker VM with two outputs (Virtual-1 at 1280x800 and a headless 1920x1080 at scale 2), sampling a wallpaper-only strip on each output during a background change, with the reveal slowed to 4s in a scratch copy so the sampling covers it.

The bug reproduces on quattro and this pull request fixes it:

tree Virtual-1 HEADLESS-2
quattro (4 runs) 1 distinct frame every run 22-24
this pull request, merged with quattro (4 runs) 21-25 22-27
only the maybeStartReveal guard change (3 runs) 22-23 23-25
only the ShaderEffectSource mask change (3 runs) 1 every run 22-24

So the first commit is the fix: dropping the revealProgress !== 0 condition lets the output that decodes late join the wipe, and on its own it makes both outputs animate. The second commit had no visible effect here. The second opinion (Codex Medium) traced Qt 6.11's qtdeclarative source and found the original construct supported: an item with layer.enabled and visible: false is kept in the scene graph through its effect reference, its changes still mark the window dirty, and QQuickShape keeps syncing a hidden shape that has effect references. That matches the worker, and it means the comment above revealMaskSource describes a mechanism the source does not bear out. The ShaderEffectSource arrangement does work, and I found nothing wrong with it beyond that. The one difference Codex found is filtering: ShaderEffectSource defaults to smooth: true where layer.smooth defaults to false.

I also checked the guard change against the rest of the file: prepared backgrounds, finishingTransition, videos, and reduced motion, where Style.duration is 0. startReveal still restarts the animation only once per backgroundVersion, and a panel that sets maskReady after the reveal has finished does nothing visible, because the incoming layer is shown unconditionally at progress 1. Codex agreed with this. Its independence from my reasoning is not guaranteed.

Tests on the worker: ./test/cli gives 91 ok and one failure, vscode generated theme references current theme file, which fails identically on quattro. runtime-smoke-test.sh, theme-background-memory-test.sh and qml-text-format-test.sh pass with the patched shell running. background-test.sh, video-background-test.sh and lock-wallpaper-preload-test.sh did not run, because the worker has no node.

I pushed one commit to your branch: a merge of quattro (8779cad), since the pull request no longer merged cleanly. quattro added screen-size decoding just above maybeStartReveal, and the conflict was textual only, so both are kept. Everything above was run on that merge.

#13126 changes only the mask (visible: false to opacity: 0) for #13125. It leaves the guard in place, so it does not fix an output that decodes late. Of the two, this is the one that fixes the multi-output symptom.

Waiting on you for one thing: on your two-output machine, does the first commit alone (6123114) still leave one output without a wipe? If it does, that is the evidence the second commit needs, and the comment should say what you measured. If it does not, the second commit can come out and this is down to the two-line guard change.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable failure was established.

Summary

The PR lets each output join a wallpaper wipe after its own image decode completes. It also waits briefly for other outputs before starting the shared animation and refreshes per-output readiness for each transition. The added test checks these QML paths.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[New background version] --> B[Each output decodes its incoming frame]
  B --> C[Output marks its mask ready]
  C --> D{All outputs ready?}
  D -- Yes --> E[Start shared reveal]
  D -- No --> F[Wait up to 250 ms]
  F --> E
  E --> G[Late outputs join at current progress]
Loading

Reviews (3) · Last reviewed commit: "Make each screen ready afresh for every ..." · Reviewed by Greptile

@sven-strothoff

Copy link
Copy Markdown
Author

Answering the question directly: no. On my two-output machine the first
commit alone is enough, and the second commit is now reverted (bafb0f5).
Your isolation is right and my reasoning for that commit was wrong.

I ran the same four-way split here. Hyprland, Qt 6.11.2, Quickshell 0.3.1,
eDP-1 at 0,0 (2400x1500 logical) and DP-12 at 2400,0 (2400x1350), both at
scale 1.6, sampling a wallpaper-only strip below the lowest mapped window
on each output.

Slowed to a 4s reveal, 30 samples per output, 10 runs per variant, counting
runs in which an output produced a single distinct frame — never changed at
all for the whole sampling window:

tree collapses
quattro 2/10
guard change only 0/10
mask change only 4/10
both 0/4

At the shipped 420ms the signal is cleaner, 40 samples per output, 6 runs:

eDP-1 DP-12
quattro 2 distinct in 5 of 6 runs 7-9
guard change only 6-9 every run 6-9 every run

The quattro failure is highly reproducible here at 420ms — eDP-1 gives
exactly two distinct frames, the old wallpaper and the new one — and the
guard change alone removes it every run. Mask-only behaves like quattro;
I would not read anything into 4/10 against 2/10 at that sample size
beyond "it does not fix it".

On the mechanism: your second opinion is right and the comment I wrote
described something the source does not do. I should not have shipped that
commit on reasoning alone. For the record on how it happened, since it may
matter for how much weight to give the rest: an early observation that the
guard change "still left one monitor without a wipe" came from a run where
the patched file had not actually loaded — a service plugin is not
re-instantiated on plugin hot-reload, only on a shell restart — and after I
found that, I went to the repaint hypothesis without re-measuring. Every
probe I ran afterwards compared stock against both changes and never
isolated the guard. So the claim in the old description was never measured,
and the thing that would have caught it is exactly the split you ran.

Thanks also for the smooth difference — ShaderEffectSource defaulting
to smooth: true against layer.smooth's false means that commit was not
even inert, which makes reverting it the clear call rather than a toss-up.

Thank you for the merge of quattro; I have left it in place and put the
revert on top of it rather than rebasing, so your commit is untouched.

On #13126: agreed that it leaves the guard in place and so does not address
an output that decodes late. I would rather not argue the other direction
of it, though — #13125 describes the reveal never animating at all, which
is not what I see here: on stock quattro at least one output animates in
every one of the 16 runs above. That may well be a real problem on another
setup or another Qt, and it is not one my measurements can speak to.

The remaining change here is the two-line guard. The follow-up in #10677 is
rebased onto this and its description corrected — it depends on this guard
change, not on the reverted commit.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P1 Static outputs miss the wipe shell/plugins/background/Background.qml:412 ▶

    When an output has no other scene activity during the transition, making revealMask invisible again removes the live mask source that drove its updates. Changes to revealProgress can then leave that output showing the old wallpaper until the transition ends, when it jumps straight to the new one. The incoming layer also samples this mask directly through maskSource: revealMask.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@sven-strothoff

Copy link
Copy Markdown
Author

@greptile-apps this P1 is the hypothesis this PR originally shipped a commit
for, and measurement contradicts it. Leaving a reply rather than just
resolving it, since it is a reasonable-sounding mechanism and it fooled me
first.

The finding predicts that restoring the live mask source is what makes a
static output animate. If that were so, the mask change on its own would
fix the symptom. It does not. Four variants, same machine, same session,
same ambient activity, only the code differing — 4s reveal, 30 samples per
output, 10 runs each, counting runs in which an output produced a single
distinct frame, i.e. never changed at all:

tree collapses
quattro 2/10
guard change only 0/10
mask change only (ShaderEffectSource, as reverted here) 4/10
both 0/4

The mask-only column is the relevant one: the live mask source is present
there and outputs still fail to animate. So it is not what drives the
updates. The guard is.

At the shipped 420ms the stock failure is near-deterministic here, 40
samples per output, 6 runs:

eDP-1 DP-12
quattro 2 distinct in 5 of 6 runs 7-9
guard change only 6-9 every run 6-9 every run

On "when an output has no other scene activity during the transition":
that is every output at every transition. The background PanelWindow's
scene holds the wallpaper images and the mask and nothing else —
application windows are separate compositor surfaces, not nodes in that
window's scene graph — so the quiet-output case is the only case, and it
is the one all of the above was measured under. It is also why ambient
activity cannot explain the stock behaviour: in those runs one output
animates and the other does not, in the same process at the same instant,
with windows mapped on both.

On the Qt side, @omarchybot reached the same isolation independently on a
two-output worker and had a second opinion trace Qt 6.11's qtdeclarative:
an item with layer.enabled and visible: false is kept in the scene
graph through its effect reference, its changes still mark the window
dirty, and QQuickShape keeps syncing a hidden shape that holds effect
references. That is the premise this finding rests on, and it does not hold
in the Qt this ships against.

Measured on Qt 6.11.2, Quickshell 0.3.1, Hyprland, two outputs at scale
1.6. I can't speak for other Qt versions — if the construct is genuinely
broken on an older one, that is worth its own issue with a measurement
attached, and #13125 may be that. It is not what is happening here.

One thing the finding is right about: maskSource: revealMask samples the
item directly again after the revert. That is deliberate — it restores
quattro's arrangement exactly, rather than leaving a change that measures
as doing nothing while also flipping the mask's filtering
(ShaderEffectSource defaults to smooth: true where layer.smooth
defaults to false).

@greptile-apps

greptile-apps Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

You’re right: the mask-only result directly falsifies my hypothesis. If the live mask source were the missing repaint driver, that variant would have eliminated the collapses, but it behaved like the baseline while the guard-only change fixed them. The controlled isolation and Qt scene-graph details support that conclusion.

I withdraw the P1 finding. The two-line guard change is the relevant fix, and restoring the original mask arrangement is appropriate here. Sorry for sending you down a plausible but incorrect path.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at bafb0f5, where the change against quattro is now the two-line guard in maybeStartReveal.

Run again on an Omarchy worker with two outputs (Virtual-1 at 1280x800 and a headless 1920x1080 at scale 2), the reveal slowed to 4s in a scratch copy, sampling a wallpaper-only strip on each output and moving to a wallpaper neither shell had seen before on every transition, so each output decodes cold. Both trees got the same eight transitions:

tree Virtual-1 HEADLESS-1
quattro 2 distinct frames (old and new) in 6 of 8 14-17
this pull request 19-21 in 8 of 8 15-17

Since the guard is now the whole diff, quattro is also this branch with the fix reverted. With two already-seen wallpapers, quattro wiped on both outputs every time, which fits the cause you describe: the race needs one output to finish decoding after the animation has started.

That also answers Greptile's finding on the revert, that a hidden revealMask with layer.enabled leaves an otherwise static output showing the old wallpaper until the end. It does not hold: the head with that mask wiped on both outputs in every run. The second opinion (Codex Medium) reviewed the change and found no defects. It traced Qt 6.11's layer implementation to show that a layer's texture changes schedule a window update without other scene activity, and walked through mid-reveal background changes, prepared backgrounds, finishingTransition, videos, zero-duration reduced motion and the theme path, with no regression. Its independence from my reasoning is not guaranteed.

Tests on the worker: ./test/cli gives 91 ok and one failure, vscode generated theme references current theme file, which fails identically on quattro. theme-background-memory-test.sh and qml-text-format-test.sh pass. runtime-smoke-test.sh fails one assertion, each widget registers its IPC handler once per screen, identically on quattro with the second output attached. background-test.sh and video-background-test.sh did not run because the worker has no node.

Nothing is waiting on you. This now waits on the maintainer, and on the suite: it cannot be called fully green on a worker until those pre-existing failures and the node gap are dealt with.

@OldJobobo

OldJobobo commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Independently reproduced and validated this fix in an isolated Omarchy VM with three outputs, including a portrait output and mixed-DPI layouts.

On a layout matching my physical desktop's geometry—2560×1440 main, 1920×1080 above, and a rotated 2560×1440 secondary—six cold wallpaper transitions at the normal 420 ms duration gave these rendered-pixel results:

Tree Main animated Top animated Portrait animated
Current quattro 0/6 1/6 6/6
This PR 6/6 6/6 6/6

I sampled narrow wallpaper strips in three parallel grim -g loops and counted intermediate reveal-band colors, not just old/new frames. This pass used the uninstrumented plugin; a separate instrumented pass confirmed that stock panels can have Image.Ready while maskReady remains false after another output starts the shared animation. No reveal-mask rendering change was needed. Actual 30 fps full-main-output recordings also show six intermediate reveal-band frames with the fix and none on stock.

Single-output behavior, actual reduced-motion configuration, and output removal during a reveal also passed. An output that does not decode until after the 420 ms animation has finished can still miss the wipe; this minimal patch deliberately does not add a startup wait.

I also prepared thirteen behavioral regression assertions that execute the actual QML JavaScript for maybeStartReveal and startReveal, with independent panel states and queued callbacks. They fail on quattro at the late-output case and pass with this patch, covering the shared animation latch and ensuring pending colors apply only once.

Full-suite verification was not entirely green: seven unrelated failures are shared between baseline and candidate in this staged VM, and two additional timing/signal failures on the candidate passed isolated reruns. The new background regression failure disappears with the fix. Environment: Hyprland 0.56.2, Quickshell 0.3.1, Qt 6.11.2, QEMU virtio GL. Physical mixed-refresh/GPU testing remains separate.

This looks like the right narrowly scoped fix; I support this existing PR rather than opening a duplicate. Happy to contribute the behavioral regression tests here if useful.

Visual comparison

Stock on the left, the minimal fix on the right. Both source recordings use the native 420 ms reveal at 30 fps; the comparison plays at the recorded speed.

background-reveal-before-after.mp4

Six frames from the fixed reveal, read left-to-right across each row:

https://github.com/user-attachments/assets/3a84b353-5f05-43da-8e7d-d6363711e19e

--[ Pi :: gpt-6.1-sol ]--
--- on behalf of: @OldJobobo

@OldJobobo

Copy link
Copy Markdown
Contributor

Follow-up, including a correction to my visual evidence above: the minimal-fix clip contains one black frame at about 1.50 s, which I missed in the initial review. Targeted testing confirmed a separate end-of-reveal handoff race on both stock and this minimal fix. I still support this PR's narrowly scoped reveal-start fix; the handoff issue can be a separate follow-up rather than a requirement to expand this PR.

When the wipe finishes, each output asynchronously loads its permanent BackgroundMedia. The first output whose base.ready becomes true currently clears the shared incoming image for all outputs. In ordinary reproductions, HEADLESS-1 cleared it while the main output was still loading; the main output's ready event followed 63–64 ms later. Both independently timestamped grim strips and 30 fps KMS recordings caught the black interval. Earlier six-run series reproduced it once on stock and once on the minimal fix.

I implemented and tested a local follow-up atop the same 81145eb1 baseline plus this PR's guard removal. It keeps the completed incoming image until every live output's permanent image is ready for the expected path/source. Completion checks run after bindings settle, including from the animation finish handler for cached/unchanged paths, and after output creation/removal. There is no startup wait, new timer, or change to the 420 ms wipe. A failed permanent decode retains the valid incoming wallpaper instead of uncovering black; subsequent transitions can cancel it. Version changes also re-arm forced same-incoming-URL transitions.

Fresh control/candidate series Ordinary transitions with a main-output flash 180 ms diagnostic delay of the main permanent layer
Minimal reveal-start fix alone 0/6 2/2
Minimal fix + handoff follow-up 0/6 0/2

The ordinary control race is intermittent, hence the explicit delay counterfactual. That delay affects only the permanent-layer handoff, not the incoming image or wipe. Both capture paths found no black interval in all eight candidate runs, and every cleanup snapshot had every output ready.

Verification: 26 new behavioral handoff assertions execute the actual QML JavaScript/handlers; the minimal fix alone fails the first one by clearing the snapshot when only one output is ready. Together with 13 reveal assertions and 13 existing background assertions, all 52 focused assertions pass. Seventeen additional VM lifecycle/state checks passed for cached paths, forced same-path transitions, failed final decode/fallback, interruption and replacement completion, instant/video cancellation, output add/remove, single output, and actual reduced motion. These are not exhaustive pixel-level acceptance for interrupted animations, and I am not claiming a green full suite; the earlier full-suite caveats still apply. Physical mixed-refresh/GPU validation remains separate.

Here is a clean uninstrumented recording of the local combination at normal recorded speed:

production-main-clean.mp4

The patch below contains only the handoff/version follow-up and its new regression test, relative to this PR's minimal guard removal. It has not been committed or submitted as another PR; sharing it here for review/contribution if useful.

Local handoff follow-up patch and 26-assertion regression test
--- a/shell/plugins/background/Background.qml
+++ b/shell/plugins/background/Background.qml
@@ -36,6 +36,7 @@
   property var nativeSizes: ({})
   property var sizeQueue: []
   property bool finishingTransition: false
+  property var backgroundPanels: []
   property int backgroundVersion: 0
   property int revealStartedVersion: -1
   property int pendingThemeVersion: -1
@@ -131,6 +132,21 @@
     revealAnimation.restart()
   }
 
+  // The incoming frame covers every output until its own permanent image is
+  // ready. One output completing its decode must not uncover another output.
+  function finishTransition() {
+    if (!finishingTransition) return
+    for (var i = 0; i < backgroundPanels.length; i++) {
+      var media = backgroundPanels[i].backgroundMedia
+      if (media.path !== displayedBackground || !media.ready || !media.current || String(media.current.source) !== String(media.imageUrl)) return
+    }
+    incomingBackground = ""
+    oldBackground = ""
+    preparedBackground = ""
+    finishingTransition = false
+    pruneNativeSizes()
+  }
+
   function prepareBackground(path) {
     path = String(path || "").trim()
     // Only a still that is not already on screen is worth decoding ahead.
@@ -266,6 +282,9 @@
         root.finishingTransition = true
       }
       root.revealProgress = 1
+      // Cached or unchanged paths may already be ready without another ready
+      // notification. Check after every output's source bindings have settled.
+      Qt.callLater(root.finishTransition)
     }
   }
 
@@ -294,6 +313,15 @@
       updatesEnabled: true
 
       property bool maskReady: false
+      readonly property var backgroundMedia: base
+      Component.onCompleted: {
+        root.backgroundPanels = root.backgroundPanels.concat([panel])
+        Qt.callLater(root.finishTransition)
+      }
+      Component.onDestruction: {
+        root.backgroundPanels = root.backgroundPanels.filter(function(p) { return p !== panel })
+        Qt.callLater(root.finishTransition)
+      }
 
       // Decode the wallpaper at the size this screen can show, not the size
       // it was shipped at. With PreserveAspectCrop Qt takes sourceSize as the
@@ -316,14 +344,6 @@
         return Qt.size(decodeWidth, decodeHeight)
       }
 
-      // Every output that has decoded the incoming image joins the wipe, even
-      // one that gets there after the animation has started. Each output
-      // decodes its own copy, so requiring revealProgress to still be 0 let
-      // whichever output decoded first claim the reveal and locked the rest
-      // out of it: they kept the old wallpaper and jumped to the new one when
-      // the transition ended. startReveal still restarts the animation only
-      // once per backgroundVersion, so a late output picks up the front where
-      // it already is.
       function maybeStartReveal() {
         if (!root.incomingBackground || maskReady) return
         if (incomingFrame.status !== Image.Ready) return
@@ -347,15 +367,7 @@
         path: root.displayedBackground
         constrainDecode: true
         decodeSize: panel.decodeSize(root.displayedBackground)
-        onReadyChanged: {
-          if (ready && root.finishingTransition) {
-            root.incomingBackground = ""
-            root.oldBackground = ""
-            root.preparedBackground = ""
-            root.finishingTransition = false
-            root.pruneNativeSizes()
-          }
-        }
+        onReadyChanged: Qt.callLater(root.finishTransition)
       }
 
       Image {
@@ -440,6 +452,12 @@
           panel.maskReady = false
           panel.maybeStartReveal()
         }
+        function onBackgroundVersionChanged() {
+          // A forced transition can reuse the same incoming path. Its version,
+          // rather than a URL change alone, must re-arm the animation latch.
+          panel.maskReady = false
+          Qt.callLater(panel.maybeStartReveal)
+        }
       }
 
       MouseArea {
--- /dev/null
+++ b/test/shell.d/background-handoff-test.sh
@@ -0,0 +1,147 @@
+#!/bin/bash
+source "$(dirname "$0")/base-test.sh"
+
+run_node_test <<'JS'
+const fs = require('fs')
+const vm = require('vm')
+const qml = fs.readFileSync(path.join(root, 'shell/plugins/background/Background.qml'), 'utf8')
+
+// Execute production QML handlers/functions, including their deferred callbacks.
+function block(marker) {
+  const start = qml.indexOf(marker)
+  if (start < 0) throw new Error(`missing ${marker}`)
+  const open = qml.indexOf('{', start)
+  let depth = 1, end = open + 1
+  while (depth && end < qml.length) {
+    if (qml[end] === '{') depth++
+    if (qml[end] === '}') depth--
+    end++
+  }
+  if (depth) throw new Error(`unterminated ${marker}`)
+  return qml.slice(open + 1, end - 1)
+}
+function fixture(count = 3) {
+  const queue = []
+  const stats = { prunes: 0 }
+  const state = vm.createContext({
+    incomingBackground: 'snapshot.png', oldBackground: 'old.png',
+    preparedBackground: 'snapshot.png', currentBackground: 'final.png',
+    displayedBackground: 'old.png', finishingTransition: false, revealProgress: 0.99,
+    backgroundPanels: [], ready: true, pruneNativeSizes() { stats.prunes++ },
+    Qt: { callLater(callback) { queue.push(callback) } }
+  })
+  state.root = state
+  const completion = qml.includes('function finishTransition(')
+    ? block('function finishTransition(') : block('        onReadyChanged:')
+  state.finishTransition = vm.runInContext(`(function() { ${completion} })`, state)
+  const panels = Array.from({length: count}, () => ({
+    backgroundMedia: {path: 'final.png', imageUrl: 'file:///final.png', ready: false,
+      current: {source: 'file:///final.png'}}
+  }))
+  state.backgroundPanels = panels
+  const finish = vm.runInContext(`(function() { ${block('    onFinished:')} })`, state)
+  function flush() { while (queue.length) queue.shift()() }
+  return { state, panels, stats, queue, finish, flush }
+}
+{
+  const f = fixture()
+  f.finish()
+  f.panels[0].backgroundMedia.ready = true
+  f.state.finishTransition()
+  f.flush()
+  assertEqual(f.state.incomingBackground, 'snapshot.png', 'first ready output retains incoming images on slower outputs')
+  assert(f.state.finishingTransition && f.stats.prunes === 0, 'unfinished handoff preserves transition state and native dimensions')
+  f.panels[1].backgroundMedia.ready = true
+  f.state.finishTransition()
+  assertEqual(f.state.incomingBackground, 'snapshot.png', 'two ready outputs cannot uncover the third')
+  f.panels[2].backgroundMedia.ready = true
+  f.state.finishTransition()
+  assertEqual(f.state.incomingBackground, '', 'last permanent image retires incoming frames')
+  assertEqual(f.state.oldBackground, '', 'completed handoff releases old image')
+  assertEqual(f.state.preparedBackground, '', 'completed handoff releases prepared image')
+  assert(!f.state.finishingTransition && f.stats.prunes === 1, 'completed handoff resets state and prunes sizes once')
+  f.state.finishTransition()
+  assertEqual(f.stats.prunes, 1, 'duplicate notifications do not repeat cleanup')
+}
+{
+  const f = fixture(1)
+  f.panels[0].backgroundMedia.ready = true
+  f.finish()
+  assertEqual(f.state.incomingBackground, 'snapshot.png', 'cached readiness is checked after source bindings settle')
+  f.flush()
+  assertEqual(f.state.incomingBackground, '', 'already-ready single output completes without a readiness edge')
+}
+{
+  const f = fixture(1)
+  const media = f.panels[0].backgroundMedia
+  media.ready = true
+  media.current.source = 'file:///old.png'
+  f.finish(); f.flush()
+  assert(f.state.finishingTransition, 'stale ready image cannot retire the incoming frame')
+  media.current.source = media.imageUrl
+  media.path = 'old.png'
+  f.state.finishTransition()
+  assert(f.state.finishingTransition, 'ready image for another path cannot complete the current handoff')
+  media.path = 'final.png'
+  media.current = null
+  f.state.finishTransition()
+  assert(f.state.finishingTransition, 'missing media item cannot complete a handoff')
+  media.current = {source: media.imageUrl}; media.ready = false
+  f.state.finishTransition()
+  assertEqual(f.state.incomingBackground, 'snapshot.png', 'failed permanent decode retains the valid incoming image')
+  media.ready = true; f.state.finishTransition()
+  assert(!f.state.finishingTransition, 'later recovery from decode failure completes the handoff')
+}
+{
+  const f = fixture()
+  f.finish(); f.flush()
+  f.panels[0].backgroundMedia.ready = true
+  f.panels[1].backgroundMedia.ready = true
+  const panel = f.panels[2]
+  const ctx = vm.createContext({root: f.state, panel, Qt: f.state.Qt})
+  vm.runInContext(`(function() { ${block('      Component.onDestruction:')} })()`, ctx)
+  f.flush()
+  assertEqual(f.state.backgroundPanels.length, 2, 'removed output leaves the readiness quorum')
+  assertEqual(f.state.incomingBackground, '', 'removing the last pending output finishes the handoff')
+}
+{
+  const f = fixture(1)
+  f.panels[0].backgroundMedia.ready = true
+  f.finish()
+  const panel = {backgroundMedia: {path: 'final.png', imageUrl: 'file:///final.png', ready: false, current: null}}
+  const ctx = vm.createContext({root: f.state, panel, Qt: f.state.Qt})
+  vm.runInContext(`(function() { ${block('      Component.onCompleted:')} })()`, ctx)
+  f.flush()
+  assertEqual(f.state.incomingBackground, 'snapshot.png', 'new output participates before cleanup')
+  panel.backgroundMedia.ready = true; panel.backgroundMedia.current = {source: panel.backgroundMedia.imageUrl}
+  f.state.finishTransition()
+  assertEqual(f.state.incomingBackground, '', 'new output becoming ready completes the handoff')
+}
+{
+  const f = fixture(0)
+  f.finish(); f.flush()
+  assertEqual(f.state.incomingBackground, '', 'no outputs retain no transition images')
+}
+{
+  const f = fixture(1)
+  f.finish()
+  f.state.finishingTransition = false
+  f.state.incomingBackground = 'next.png'
+  f.panels[0].backgroundMedia.ready = true
+  f.flush()
+  assertEqual(f.state.incomingBackground, 'next.png', 'stale completion callback cannot clear a replacement transition')
+  f.state.incomingBackground = ''; f.flush()
+  assertEqual(f.stats.prunes, 0, 'instant or video cancellation cannot run stale cleanup')
+}
+{
+  const f = fixture(1)
+  const panel = {maskReady: true, maybeStartReveal() { panel.calls++ }, calls: 0}
+  const ctx = vm.createContext({root: f.state, panel, Qt: f.state.Qt})
+  vm.runInContext(`(function() { ${block('function onBackgroundVersionChanged(')} })()`, ctx)
+  assert(!panel.maskReady, 'forced same-path transition resets the output mask by version')
+  assertEqual(panel.calls, 0, 'forced same-path readiness waits for bindings to settle')
+  f.flush()
+  assertEqual(panel.calls, 1, 'forced same-path transition checks readiness without a URL change')
+}
+assert(qml.includes('onReadyChanged: Qt.callLater(root.finishTransition)'), 'per-output ready changes schedule shared completion checks')
+JS

--[ Pi :: gpt-6.1-sol ]--
--- on behalf of: @OldJobobo

omarchybot and others added 3 commits October 16, 2026 01:08
quattro slowed the reveal to 840ms and moved Background.qml on; the merge is clean, and the guard change is kept as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the guard dropped, a screen that decodes late joins the wipe partway through. Waiting up to 250ms after the first screen is ready, as omacom#14268 proposed, lets a screen that is only a little slower show the whole wipe. The screens still decoding are read from the attached panels rather than counted, so an unplugged monitor is never mistaken for a ready one, and the pending theme's fallback is pushed past the wait when it begins, so the colours never change before the reveal they belong to.

Co-Authored-By: AnPod <1073516+AnPod@users.noreply.github.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Readiness was reset only when the incoming path changed. Now that a screen that decodes late joins the reveal, a forced transition that keeps the incoming path found every screen still ready from the last one, so nothing started or waited for it and the reveal stayed at zero; quattro only recovered when a screen had been locked out. Resetting on the transition's version, after its state settles, covers it.

Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

I pushed three commits to this branch. The new head is cdf0db4. @AnPod's #14268 fixes the same bug, and its one real addition is now carried here, credited to them. A defect I found in the guard change is fixed as well.

  • 1e219c2, a merge of quattro. It merged cleanly. It brings in quattro's slower 840 ms reveal and keeps the guard change as it was.
  • 63b1b48, a short wait for every screen before the reveal starts. With only the guard change, the screen that decodes late joins the wipe, but on the worker it usually joined at 70-100% of the way through, so it showed only the last sliver. Animate background reveal across all screens in multi-monitor setups #14268's idea is to wait up to 250 ms after the first screen is ready, so a slightly slower screen sees the whole wipe. That is folded in here, with two of Animate background reveal across all screens in multi-monitor setups #14268's details fixed on the way. The screens still decoding are read from the panels that are attached, so a monitor unplugged mid-wait never counts as ready. When the wait begins, the pending theme's fallback timer restarts, so the colours do not change before the reveal they belong to.
  • cdf0db4, every screen becomes ready afresh on each transition. maskReady was reset only when the incoming path changed. Now that a late screen sets maskReady, a forced transition (themeTransition) to the same incoming path found every screen still ready from the last one. Nothing called startReveal again, and the reveal stayed at zero with the old wallpaper on screen. quattro avoided this only because a late screen was locked out. Readiness is now reset on backgroundVersion and checked again once the transition's state has settled.

Run on an Omarchy worker with two outputs, Virtual-1 at 1280x800 and a headless 1920x1080 at scale 2. Each tree got eight transitions to a wallpaper neither screen had decoded before, with log probes in a scratch copy:

tree Virtual-1 joined the wipe
quattro never, 8 of 8 snapped at the end
this head with the revealProgress !== 0 guard restored never, 8 of 8
this head 8 of 8, at progress 0.09-0.99

On a forced same-path transition partway through a reveal, the guard change alone stopped at zero in 3 of 3 runs. This head started the reveal again and finished it in 3 of 3.

./test/cli passes (125 ok). ./test/shell fails four tests at this head, the same four that fail on quattro on the same worker: the "Hi" width, the plain block-art logo, the da/menu.json catalog and pre_remove. None of them touch the background. The new assertions in test/shell.d/background-test.sh pass here. They check the code's structure, not the timing. In a first full run, four timing and IPC tests failed at this head, but they passed when re-run on their own, twice, and in a second full run.

I reviewed this with Claude Opus 5.5. Codex Medium gave a second opinion over three rounds. In the second round it found the forced same-path stall, and in the third it found nothing open across the whole diff. It can read this session's work, so its agreement is not guaranteed to be independent. Two costs come with the wait, and Codex judged both acceptable: the first screen starts the reveal up to 250 ms later, including with reduced motion, and a theme fallback that has already fired can now precede the reveal by up to 250 ms more.

This is verified and waiting on the maintainer, who also chooses between this and #14268. It is not labelled ready only because the full suite is not green on quattro itself.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

The main multi-monitor wipe fix is now on quattro through #17179 (8e1f951c8c35b2fa8101a5da681237e7a37e2644). This branch conflicts with that implementation. It still adds a readiness reset for forced transitions that reuse an incoming image path, and restarts the theme fallback when the decode wait begins; #17179 did not carry those changes. The remaining work needs a maintainer decision about scope before this branch is brought forward.

For the failed translation workflow, I ran both CI entry points on a disposable Omarchy worker at cdf0db40e6cb1681122d4155202dded61ddc49f5, its merge base 8a787b6a8bec830b04543bf14c760ee0a10591f6, and current quattro (f989b43e91ab16ce3675bd1ec5535e093e907ce0). I18N_STRUCTURAL=1 bash test/shell.d/i18n-test.sh fails identically while generating the Danish locale on the head and merge base, and passes on current quattro. python3 scripts/i18n-sync.py extract-scan --check passes on all three. The original workflow's logs and job details are unavailable, so that run's exact failure remains unconfirmed.

Reviewed by GPT-6 High in Codex, with second opinions from Opus 5.5 High and muse-wonder via pi, thinking high. Both second opinions agreed that the remaining scope needs the maintainer; that agreement is not guaranteed to be independent. No commits were pushed. This remains open awaiting the maintainer's decision on the remaining changes; the animation and full suite were not reverified in this CI follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants