Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion shell/plugins/background/Background.qml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ Item {
failedBackground = ""
revealStartedVersion = -1

// OWE draws a video background and fades the last still into it. That
// still stays on screen until OWE has the first frame and suspends this
// layer, so the desktop does not show an empty background meanwhile. A
// running reveal finishes on its incoming still, which OWE fades from.
if (!instant && !root.suspended && displayedBackground && isVideo(path) && !isVideo(displayedBackground)) return

revealAnimation.stop()
finishingTransition = false

Expand Down Expand Up @@ -326,7 +332,10 @@ Item {
easing.type: Easing.OutCubic
onFinished: {
if (root.incomingBackground) {
root.displayedBackground = root.currentBackground || root.incomingBackground
// After a video was chosen during the reveal, the incoming still
// stays until OWE takes the background.
root.displayedBackground = root.currentBackground && !root.isVideo(root.currentBackground)
? root.currentBackground : root.incomingBackground
root.finishingTransition = true
}
root.revealProgress = 1
Expand Down
4 changes: 3 additions & 1 deletion test/shell.d/background-pending-theme-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ln -s "$ROOT/shell/plugins/background" "$stage/background"
ln -s "$ROOT/shell/Commons" "$stage/Commons"
ln -s "$ROOT/shell/Ui" "$stage/Ui"
magick -size 128x128 xc:magenta "$stage/still.png"
magick -size 128x128 xc:cyan "$stage/home/next.png"
ln -s "$stage/still.png" "$stage/home/.local/state/omarchy/current/background"
python3 - "$ROOT/shell/shell.qml" "$SHELL_TEST_DIR/fixtures/background-pending-theme/shell.qml" "$stage/shell.qml" <<'PY'
import re
Expand All @@ -26,5 +27,6 @@ fixture = Path(sys.argv[2]).read_text()
Path(sys.argv[3]).write_text(fixture.replace(' // APPLY_THEME_FUNCTION', method.group()))
PY
output=$(HOME="$stage/home" timeout 10 quickshell -p "$stage" --no-color 2>&1) || fail "pending theme fixture exits cleanly" "$output"
[[ $output == *"RESULT pass"* && $output != *"RESULT fail"* ]] || fail "the authoritative palette survives the previous background fallback timer" "$output"
[[ $output == *"RESULT pass"* && $output != *"RESULT fail"* ]] || fail "the palette survives the fallback timer, and a still covers the desktop until OWE takes a video" "$output"
pass "a pending still transition cannot restore old colors after the current theme is applied"
pass "a video chosen during a reveal keeps the stills on screen, and the reveal ends on its still"
35 changes: 30 additions & 5 deletions test/shell.d/fixtures/background-pending-theme/shell.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import "background" as BackgroundPlugin
ShellRoot {
id: shell
function firstPartyServiceFor(id) { return id === "omarchy.background" ? background : null }
property bool failed: false
function check(ok, message) {
if (!ok) {
failed = true
console.log("RESULT fail " + message)
}
}
BackgroundPlugin.Background { id: background }

// APPLY_THEME_FUNCTION
Expand All @@ -25,11 +32,29 @@ ShellRoot {
interval: 1300
running: true
onTriggered: {
if (Qt.colorEqual(Commons.Color.accent, "#123456")) {
console.log("RESULT pass")
} else {
console.log("RESULT fail previous colors returned: " + Commons.Color.accent)
}
shell.check(Qt.colorEqual(Commons.Color.accent, "#123456"), "previous colors returned: " + Commons.Color.accent)

// OWE fades the last still into a video and suspends this layer after
// the video's first frame. Until then the stills must cover the desktop,
// also when the video is chosen during a reveal.
background.setBackground(Quickshell.env("HOME") + "/next.png", false)
background.setBackground("/backgrounds/clip.mp4", false)
shell.check(background.displayedBackground.endsWith("/still.png") && background.incomingBackground.endsWith("/next.png"),
"a video keeps the reveal's stills: " + background.displayedBackground)
revealEnd.running = true
}
}
Timer {
id: revealEnd
interval: 50
repeat: true
property int ticks: 0
onTriggered: {
ticks += 1
if (background.incomingBackground && ticks < 80) return
running = false
shell.check(background.displayedBackground.endsWith("/next.png"), "the reveal ends on its still, not on the video: " + background.displayedBackground)
if (!shell.failed) console.log("RESULT pass")
Qt.quit()
}
}
Expand Down
Loading