Skip to content

Show portrait wallpaper twins on portrait screens - #11534

Open
kravens wants to merge 2 commits into
omacom:quattrofrom
kravens:portrait-background-twins
Open

kravens wants to merge 2 commits into
omacom:quattrofrom
kravens:portrait-background-twins

Conversation

@kravens

@kravens kravens commented Sep 12, 2026 •

Copy link
Copy Markdown

Discussion with the design and alternatives: #11533

What

A theme may ship backgrounds/portrait/<same file name>. The background plugin shows the twin on screens taller than wide and the plain file elsewhere — for the base frame and both transition frames — so one current/background link serves a landscape and a rotated monitor at once.

  • The size probe that already reads each wallpaper's header (magick identify -ping) also probes the twin, and records whether it was found. A portrait screen binds a twin only once the probe has found it, and waits for the probe the same way frames already wait for the native size. Themes without twins behave exactly as before.
  • Only files directly inside a backgrounds folder, ~/.config/omarchy/backgrounds/<theme>/ or the transition snapshot folder have twins. Landscape screens never rewrite a path.
  • omarchy-theme-set snapshots the twin as background-transitions/portrait/<snapshot name> next to the plain snapshot, so theme switches and the prepared frame reveal the twin too; the snapshots are removed together. When a theme switch's reveal finishes, the durable path and its twin are probed again, since two themes can ship the same file name.
  • The reveal already waits for every screen's base frame (Slide background changes on every monitor without a black flash #17179), which now covers screens decoding different files.
  • Not covered: the theme intro cover (BackgroundIntro) draws the outgoing still as one file on every screen, so with intros on, a portrait screen shows the landscape image under the cover for the length of the intro. Fine as a follow-up once the convention is in.
  • No change to the picker, bg next or theme switching: they list backgrounds/ with -maxdepth 1, so the subfolder is never offered as a wallpaper. Videos are untouched (OWE draws them).

Why

On a 3840x2160 + rotated 2560x1440 setup the portrait screen shows the landscape image cropped to its middle third; the subject is usually cut off. Themes had no way to express an alternative.

Testing

  • test/shell.d/background-portrait-twins-test.sh. The bash part runs snapshot_background_path / remove_background_snapshots against a theme with and without a twin, a user background and a picture outside backgrounds/. The fixture runs the plugin itself on the compositor with the first screen made portrait: the twin is on that screen at boot, stays through two reveals, gives way to the plain file for a background without a twin, and comes back when a twin appears behind the same path and the path is reloaded. background-pending-theme, background-startup*, background-intro*, video-background and theme-background-memory tests pass alongside.
  • Tested live on Hyprland with DP-2 (landscape) + DP-1 (transform 1), running this branch's shell. Wallpaper sets and theme switches (twin appearing or disappearing on the same path, user backgrounds) landed on the expected file per screen, with no empty frames in 360 captures during switches; details in the PR comments. A capture from an earlier revision (left: DP-2 3840x2160, right: DP-1 rotated 1440x2560):

landscape and portrait screens sharing one background link

Reference theme using the convention: https://github.com/kravens/omarchy-bitcoin-frontier-theme

@kravens
kravens marked this pull request as ready for review September 12, 2026 17:44
@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
@llstrk

llstrk commented Oct 1, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Outcome: On all-portrait setups, wallpaper changes in themes without twins and image theme switches stall.

Transition frames have no missing-twin fallback

The transition frames use oriented() with no fallback, and the reveal waits for incomingFrame to be Ready. When every output is portrait, changes in themes without portrait/ files never reveal, and image theme switches always stall: the snapshot from omarchy-theme-set maps to .../background-transitions/portrait/next-<pid>.<ext>. Impact: the old wallpaper stays (the merge-base completes); mixed setups briefly show no image on the portrait screen; files in any portrait folder are rewritten on landscape screens.

Suggested change: Resolve the twin from the durable path, check once per panel that it exists before any frame binds to it, and only rewrite paths inside a backgrounds folder.

Reproducer (fails at 0b551cd)

Reproducer: transition frames have no missing-twin fallback (reviewed head 0b551cd)

1. Test in the style of test/shell.d/background-test.sh

Save as test/shell.d/portrait-twin-repro-test.sh and run bash test/shell.d/portrait-twin-repro-test.sh. Blocks 1 and 2 belong to this finding; block 3 is the video finding.

#!/bin/bash
# Reproducer for omacom/omarchy#11534, in the style of test/shell.d/background-test.sh.
# Drop into test/shell.d/ next to background-test.sh. Each block reports on its own.
source "$(dirname "$0")/base-test.sh"

test_tmp=$(mktemp -d)
trap 'rm -rf "$test_tmp"' EXIT
status=0

# The snapshot omarchy-theme-set hands to `background themeTransition` as the incoming path.
source <(awk '/^(is_video_path|snapshot_background_path)\(\) \{/ { c=1 } c { print } c && /^}$/ { c=0 }' "$ROOT/bin/omarchy-theme-set")
BACKGROUND_TRANSITION_CACHE="$test_tmp/cache/omarchy/background-transitions"
mkdir -p "$test_tmp/theme/backgrounds/portrait" "$test_tmp/Pictures/portrait"
printf 'plain\n' >"$test_tmp/theme/backgrounds/1-moonrise.png"
printf 'twin\n' >"$test_tmp/theme/backgrounds/portrait/1-moonrise.png"
printf 'photo\n' >"$test_tmp/Pictures/portrait/beach.png"
export SNAPSHOT=$(snapshot_background_path "$test_tmp/theme/backgrounds/1-moonrise.png" next)
export TEST_TMP="$test_tmp"

prelude='
const fs = require("fs")
const backgroundQml = fs.readFileSync(path.join(root, "shell/plugins/background/Background.qml"), "utf8")
const fn = backgroundQml.match(/function oriented\(path\) \{[\s\S]*?\n      \}/)[0]
const oriented = (screen, orientFailedFor, p) => new Function("panel", "orientFailedFor", "path", `${fn.replace("function oriented(path)", "const oriented = (path) =>")}; return oriented(path)`)({ screen }, orientFailedFor, p)
const portrait = { width: 1440, height: 2560 }
const landscape = { width: 3840, height: 2160 }
'

run_node_test <<JS || status=1
$prelude
// A theme switch reveals the snapshot, not the theme file. The portrait lookup
// points into the snapshot cache, where no portrait/ folder is ever created.
const looked = oriented(portrait, '', process.env.SNAPSHOT)
assert(fs.existsSync(looked), 'a theme switch gives a portrait screen an incoming frame that exists', 'snapshot: ' + process.env.SNAPSHOT + '\nportrait lookup: ' + looked)
JS

run_node_test <<JS || status=1
$prelude
// A wallpaper that lives in any folder named "portrait" is rewritten on a
// landscape screen to a sibling that need not exist.
const wallpaper = path.join(process.env.TEST_TMP, 'Pictures/portrait/beach.png')
const looked = oriented(landscape, '', wallpaper)
assert(fs.existsSync(looked), 'a landscape screen keeps a wallpaper whose folder happens to be named portrait', 'wallpaper: ' + wallpaper + '\nlandscape lookup: ' + looked)
JS

run_node_test <<JS || status=1
$prelude
// Videos take the same lookup, but the video player never reports failed, so a
// missing twin is never replaced by the linked file.
const videoQml = fs.readFileSync(path.join(root, 'shell/Ui/BackgroundVideo.qml'), 'utf8')
const clip = '/theme/backgrounds/3-clip.mp4'
assert(oriented(portrait, '', clip) === clip || /property bool failed/.test(videoQml), 'a video wallpaper on a portrait screen can fall back when it has no twin', 'portrait lookup: ' + oriented(portrait, '', clip) + '\nBackgroundVideo.qml declares failed: ' + /property bool failed/.test(videoQml))
JS

exit $status

Actual output at the reviewed head (stdout was empty; this is stderr, exit status 1). Only the sandbox temp directory, shown as $TEST_TMP, and the process ID, shown as <pid>, are redacted:

snapshot: $TEST_TMP/cache/omarchy/background-transitions/next-<pid>.png
portrait lookup: $TEST_TMP/cache/omarchy/background-transitions/portrait/next-<pid>.png
not ok - a theme switch gives a portrait screen an incoming frame that exists
wallpaper: $TEST_TMP/Pictures/portrait/beach.png
landscape lookup: $TEST_TMP/Pictures/beach.png
not ok - a landscape screen keeps a wallpaper whose folder happens to be named portrait
portrait lookup: /theme/backgrounds/portrait/3-clip.mp4
BackgroundVideo.qml declares failed: false
not ok - a video wallpaper on a portrait screen can fall back when it has no twin

2. What the PR's Background.qml does with those paths

Offscreen qml6 harness that loads the PR's shell/plugins/background/Background.qml and shell/Ui/BackgroundMedia.qml unchanged except for removing the three WlrLayershell.* lines, with stub Quickshell types (Variants, PanelWindow, Process, IpcHandler) and fake screens (DP-1 1440x2560 portrait, DP-2 3840x2160 landscape). Each scenario shows one wallpaper, then calls setBackground(next, false) (what omarchy theme bg set / bg next / the picker send) or transitionBackgroundWithTheme(<previous snapshot>, <next snapshot>, <theme file>) (what omarchy-theme-set sends), then waits 3 s. base is the merge-base 31bd80d, head is the PR. Actual output:

portrait-notwin-bgset @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
portrait-notwin-bgset @ head (t+3000ms after the change): displayed=1-alpha.png wanted=2-beta.png revealProgress=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/1-alpha.png [Ready] incomingFrame=state/omarchy/current/theme/backgrounds/portrait/2-beta.png [Error] longest-no-image-ms=0
portrait-twin-bgset @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
portrait-twin-bgset @ head (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/portrait/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
portrait-twin-themeswitch @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
portrait-twin-themeswitch @ head (t+3000ms after the change): displayed=1-alpha.png wanted=2-beta.png revealProgress=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/portrait/1-alpha.png [Ready] incomingFrame=cache/omarchy/background-transitions/portrait/next-4242.png [Error] longest-no-image-ms=0
landscape-portraitdir-bgset @ base (t+3000ms after the change): displayed=y.png wanted=y.png revealProgress=1
    DP-2 3840x2160: base=Pictures/portrait/y.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
landscape-portraitdir-bgset @ head (t+3000ms after the change): displayed=x.png wanted=y.png revealProgress=0
    DP-2 3840x2160: base=Pictures/portrait/x.png [Ready] incomingFrame=Pictures/y.png [Error] longest-no-image-ms=0

At the head, a portrait-only setup never finishes a change for a theme without portrait/ files, and never finishes a theme switch even when the theme ships twins (the incoming path is the snapshot in ~/.cache/omarchy/background-transitions/). A landscape-only setup stalls the same way when the wallpaper sits in a folder named portrait with no file of the same name one level up. The merge-base completes every case.

Mixed setups complete, but after the wipe the portrait output has no loaded image while its base reloads. Its incoming frame fails for themes without twins and for theme switches, and even with twins the landscape output can finish first and clear the shared incoming frame. Actual output (state 100 ms into the change, then the final state with the longest interval in which that output had no loaded image):

mixed-notwin-bgset @ base, 100 ms into the change (revealProgress=0.014):
    DP-2 3840x2160: incomingFrame=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] wipe-mask-ready=False
    DP-1 1440x2560: incomingFrame=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] wipe-mask-ready=True
mixed-notwin-bgset @ head, 100 ms into the change (revealProgress=0.028):
    DP-2 3840x2160: incomingFrame=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] wipe-mask-ready=True
    DP-1 1440x2560: incomingFrame=state/omarchy/current/theme/backgrounds/portrait/2-beta.png [Error] wipe-mask-ready=False
mixed-twin-themeswitch @ base, 100 ms into the change (revealProgress=0.015):
    DP-2 3840x2160: incomingFrame=cache/omarchy/background-transitions/next-4242.png [Ready] wipe-mask-ready=True
    DP-1 1440x2560: incomingFrame=cache/omarchy/background-transitions/next-4242.png [Ready] wipe-mask-ready=False
mixed-twin-themeswitch @ head, 100 ms into the change (revealProgress=0.014):
    DP-2 3840x2160: incomingFrame=cache/omarchy/background-transitions/next-4242.png [Ready] wipe-mask-ready=True
    DP-1 1440x2560: incomingFrame=cache/omarchy/background-transitions/portrait/next-4242.png [Error] wipe-mask-ready=False
mixed-notwin-bgset @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
mixed-notwin-bgset @ head (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=38
mixed-twin-bgset @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
mixed-twin-bgset @ head (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/portrait/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=20
mixed-twin-themeswitch @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
mixed-twin-themeswitch @ head (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/portrait/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=62
mixed-notwin-bgset-noisy @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
mixed-notwin-bgset-noisy @ head (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=42
mixed-notwin-themeswitch @ base (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
mixed-notwin-themeswitch @ head (t+3000ms after the change): displayed=2-beta.png wanted=2-beta.png revealProgress=1
    DP-2 3840x2160: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=0
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/2-beta.png [Ready] incomingFrame=- [Null] longest-no-image-ms=36

The test images are solid-colour or noise PNGs at 3840x2160 (twins 2160x3840), so the empty interval here is 20 to 62 ms; it grows with the wallpaper's decode time. Every failed twin lookup logs QML Image: Cannot open: file:///..., and every fallback of the base frame also logs QML Image: Binding loop detected for property "failed". Neither warning appears in any merge-base scenario.

More findings

Video wallpapers without a portrait twin get no fallback on a portrait screen (reviewed head only). oriented() also rewrites .mp4 paths, and BackgroundVideo.qml has no failed property, so BackgroundMedia.failed stays false and the player stays on the missing portrait/<name>.mp4. Impact: a portrait output keeps trying to open a file that does not exist instead of the linked video. On the current quattro, OWE draws videos, so a rebase removes this path.

Suggested change: Skip video paths in oriented().

Reproducer: video wallpapers on a portrait output get no fallback (reviewed head 0b551cd)

1. Test in the style of test/shell.d/background-test.sh

Block 3 of test/shell.d/portrait-twin-repro-test.sh (the full file is in the transition-stall reproducer; this block runs on its own with the same prelude):

run_node_test <<JS || status=1
$prelude
// Videos take the same lookup, but the video player never reports failed, so a
// missing twin is never replaced by the linked file.
const videoQml = fs.readFileSync(path.join(root, 'shell/Ui/BackgroundVideo.qml'), 'utf8')
const clip = '/theme/backgrounds/3-clip.mp4'
assert(oriented(portrait, '', clip) === clip || /property bool failed/.test(videoQml), 'a video wallpaper on a portrait screen can fall back when it has no twin', 'portrait lookup: ' + oriented(portrait, '', clip) + '\nBackgroundVideo.qml declares failed: ' + /property bool failed/.test(videoQml))
JS

Actual output of that block at the reviewed head (from the same run as the full file):

portrait lookup: /theme/backgrounds/portrait/3-clip.mp4
BackgroundVideo.qml declares failed: false
not ok - a video wallpaper on a portrait screen can fall back when it has no twin

2. What the PR's BackgroundMedia does with it

Same offscreen qml6 harness as the transition-stall reproducer (the PR's Background.qml, BackgroundMedia.qml and BackgroundVideo.qml with stub Quickshell types; Qt Multimedia's FFmpeg backend loads inside the sandbox). One portrait output, setBackground(<theme>/backgrounds/3-gamma.mp4), state 3.3 s later. Actual output:

portrait-video @ base (t+3300ms after the change): displayed=3-gamma.mp4 wanted=3-gamma.mp4 revealProgress=1
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/3-gamma.mp4 [None] incomingFrame=- [Null] longest-no-image-ms=0
portrait-video @ head (t+3300ms after the change): displayed=3-gamma.mp4 wanted=3-gamma.mp4 revealProgress=1
    DP-1 1440x2560: base=state/omarchy/current/theme/backgrounds/portrait/3-gamma.mp4 [None] incomingFrame=- [Null] longest-no-image-ms=0

The base frame's item and failed flag at both snapshots (actual output):

base t+1300ms: base frame item=BackgroundVideo path=state/omarchy/current/theme/backgrounds/3-gamma.mp4 BackgroundMedia.failed=None
base t+3300ms: base frame item=BackgroundVideo path=state/omarchy/current/theme/backgrounds/3-gamma.mp4 BackgroundMedia.failed=None
head t+1300ms: base frame item=BackgroundVideo path=state/omarchy/current/theme/backgrounds/portrait/3-gamma.mp4 BackgroundMedia.failed=False
head t+3300ms: base frame item=BackgroundVideo path=state/omarchy/current/theme/backgrounds/portrait/3-gamma.mp4 BackgroundMedia.failed=False

At the head, Qt Multimedia's log for that run:

qt.multimedia.ffmpeg.mediadataholder: Could not open media. FFmpeg error description: No such file or directory

[None] in the first block means the base frame holds the video player rather than an Image; failed=None means the merge-base has no failed property. The head keeps the player on the missing portrait/3-gamma.mp4 for the whole run: BackgroundVideo.qml has no failed property, so BackgroundMedia.failed (current.failed === true) stays false and onFailedChanged never switches back to the linked file. The merge-base player gets the linked path. (The harness's .mp4 is not a real video, so the merge-base player then reports invalid data; the point is the path each side opens.)

Rebase needed. A trial three-way merge onto quattro 8b4eae6 gives 4 conflict hunks in Background.qml and 1 in BackgroundMedia.qml. quattro now gates every frame on a decode size probed per path (decodeSize(path), root-level paths only), so a rebased oriented() also needs to probe twin paths, and the new prepare frame loads a snapshot path like the case above. Open PRs #10249, #11451 and #9312 implement the same feature differently.

Suggested change: When rebasing, probe and prune decode sizes for twin paths as well.

Details

Verified (offscreen QML harness with the PR's own QML and stubbed Quickshell types, plus source reading):

  • With a twin-shipping theme and omarchy theme bg set/bg next/the picker, the portrait screen shows the twin on all three frames, and landscape screens keep the plain file.
  • When a still-image twin is missing, the base frame falls back to the linked file.
  • Every lister (omarchy-menu-images, the image picker, omarchy-theme-bg-next, omarchy-theme-set, omarchy-theme-switcher) uses -maxdepth 1, so portrait/ files are never offered or cycled.

Optional test improvement: the new test still passes all 8 assertions with onFailedChanged deleted or with failed forced to false, so it does not exercise the fallback. A test that runs the transition frames' lookup against a theme-switch snapshot path (block 1 of the reproducer) would catch the theme-switch case of the stall.

Reproducer: the new test passes with the fallback removed (reviewed head 0b551cd)

Two mutations of the head, each run against the PR's unchanged test/shell.d/background-test.sh.

Mutation 1 removes the fallback hook from shell/plugins/background/Background.qml:

new, n = re.subn(r"\n        onFailedChanged: \{\n.*?\n        \}\n", "\n", s, flags=re.S)
assert n == 1, n

Mutation 2 makes the image never report failure in shell/Ui/BackgroundMedia.qml:

old = "readonly property bool failed: status === Image.Error"
s.replace(old, "readonly property bool failed: false")

Actual output of bash test/shell.d/background-test.sh with mutation 1 (exit status 0, stderr empty):

ok - background theme switcher starts theme application asynchronously after selection
ok - background theme transition applies pending colors even if image reveal stalls
ok - background base, old and incoming frames resolve the portrait twin per screen
ok - BackgroundMedia reports a failed image so a missing twin can fall back
ok - portrait screen swaps to backgrounds/portrait/<same name>
ok - landscape screen keeps the plain file
ok - landscape screen swaps a portrait twin back to the plain file
ok - a path whose twin failed to load stays on the plain file

Actual output with mutation 2 (exit status 0, stderr empty):

ok - background theme switcher starts theme application asynchronously after selection
ok - background theme transition applies pending colors even if image reveal stalls
ok - background base, old and incoming frames resolve the portrait twin per screen
ok - BackgroundMedia reports a failed image so a missing twin can fall back
ok - portrait screen swaps to backgrounds/portrait/<same name>
ok - landscape screen keeps the plain file
ok - landscape screen swaps a portrait twin back to the plain file
ok - a path whose twin failed to load stays on the plain file

All eight assertions pass in both cases. The test checks that the three bindings and a failed: declaration exist as text, and runs oriented() on its own; it never exercises the failure path, the transition frames, the theme-switch snapshot paths or video paths.


Review information

Test scope: Source review, Node tests and an offscreen QML harness at 0b551cd; not tested on live Hyprland or a rotated monitor.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect wallpaper display and theme transitions across desktop screens.

The previous wallpaper hang is fixed, but the tests must follow the repository’s existing-suite requirement before merging.

Findings

  1. P2 New suite breaks test rules ▶

Summary

Adds portrait wallpaper twins while keeping one shared background link.

  • Portrait screens use a matching wallpaper twin when one is available.

Reviews (5) · Last reviewed commit: "Drop an undecodable twin on the transiti..." · Reviewed by Greptile

Comment thread shell/plugins/background/Background.qml Resolved
Comment thread shell/plugins/background/Background.qml Resolved
@kravens

kravens commented Oct 2, 2026

Copy link
Copy Markdown
Author

@llstrk Thanks for the review and the reproducers. This is now rebased onto quattro 821ae58 and reworked (7ca5fbe, plus 8cbdd99 for the Greptile follow-ups):

  • Transition frames stalling when the twin is missing: the Image.Error fallback is gone. The existing magick identify -ping size probe now also probes the twin and records whether it was found. A portrait screen binds a twin only after the probe has found it, and until then it waits the same way frames already wait for the native size. The BackgroundMedia.qml changes are dropped.
  • Theme-switch snapshots: omarchy-theme-set copies the twin to background-transitions/portrait/<snapshot name> alongside the main snapshot and removes both together. Theme switches and the prepared frame now find it the same way the durable path does.
  • Folders named portrait: only files directly inside a backgrounds folder (or ~/.config/omarchy/backgrounds/<theme>/, or the snapshot folder) have twins. Landscape screens never rewrite a path.
  • Brief blank on mixed setups: the incoming frame now stays up until every sized panel's base frame is ready (Variants.instances), not only the fastest one.
  • Videos: never get a twin. OWE draws them on quattro anyway.
  • Rebase: twins go through the decode-size probe, and pruneNativeSizes() keeps the twin entries of every wallpaper in play.
  • Test: background-test.sh now runs the extracted twinPath() / oriented() / probe-queue functions against found, missing and pending twins, snapshot paths, user backgrounds, pictures elsewhere, videos and landscape screens. It also runs snapshot_background_path / remove_background_snapshots. Removing the refresh or the user-folder match makes it fail.

video-background-test.sh fails with PREPARED_BACKGROUND_SNAPSHOT: unbound variable on untouched quattro too. I haven't re-tested this revision on the rotated monitor yet.

@kravens

kravens commented Oct 3, 2026

Copy link
Copy Markdown
Author

Tested live on Hyprland with DP-2 (3840x2160, landscape) and DP-1 (2560x1440, transform 1), running this branch's shell from a checkout. I drove it over the background IPC and checked the middle of each output with grim -o against solid-colour test wallpapers.

  • background set: a theme background with a twin, one without, a user background in ~/.config/omarchy/backgrounds/<theme>/ with a twin, and a picture outside a backgrounds folder that has a portrait/ sibling. All showed the expected file on each screen.
  • Theme switches, following the steps of set_theme_background (snapshot, prepare, swap current/theme, themeTransition), 3 rounds each: switching to a user background, a twin appearing on the same durable path, and a twin disappearing on it. All landed correctly. I took 360 DP-1 captures during the switches and none was empty. There were no Cannot open warnings and no leftover snapshot files.

Testing turned up one issue, fixed in e360398. The twin check that a theme switch repeats could answer mid-reveal and move the portrait screen's base frame to another file while nothing covered it, which showed as an empty frame. The answers for the landing path are now dropped when the reveal finishes, while the incoming frame still covers every screen, and the transition finishes only once both probes have answered. background-test.sh passes (30 assertions).

Separately, when two themes ship a background with the same file name, the previous theme's image stays on screen after the switch. Untouched quattro does the same, so I filed it as #14191 rather than change it here.

A theme may ship backgrounds/portrait/<same file name>, as may a user's
~/.config/omarchy/backgrounds/<theme>/. The background plugin shows that
twin on screens taller than wide and the plain file elsewhere, for the
base frame and both transition frames, so one current/background link
serves a landscape and a rotated monitor at once.

The size probe that already reads each wallpaper's header also probes
the twin and records whether it was found. A portrait screen binds the
twin only once the probe has found it, waits for the probe the way
frames already wait for the native size, and falls back to the plain
file when the twin is missing or will not decode. omarchy-theme-set
snapshots the twin next to the plain snapshot so theme switches and the
prepared frame reveal it too, and removes both together. A forced
reload or a theme switch landing on the same durable path probes the
file and its twin again, since the files behind the path have changed.

The fixture runs the plugin on the compositor with the first screen made
portrait, through boot, two reveals, a background without a twin and a
twin appearing behind the same path.
@kravens
kravens force-pushed the portrait-background-twins branch from e360398 to 90c6f49 Compare November 3, 2026 18:22
@kravens

kravens commented Nov 3, 2026

Copy link
Copy Markdown
Author

Rebased onto quattro 8d07724 (was 821ae58, 871 commits behind) and re-ported as one commit, 90c6f49.

What changed in the port:

Not covered: the theme intro cover (BackgroundIntro) draws the outgoing still as one file on every screen, so with intros on, a portrait screen shows the landscape image under the cover for the length of the intro. I left that for a follow-up once the convention is in, rather than widen this PR.

For context, #10249 and #11451 overlap with this one (named monitor overrides in shell.json, and a variant folder per image picked by aspect ratio). This PR is the smallest of the three: one convention, no picker or config change. Either of the others could layer on top of it.

Comment thread shell/plugins/background/Background.qml Resolved
The incoming and old frames bound a twin that passed the size probe but
failed to decode and then waited on the error. On a setup where every
screen is portrait no screen reached incomingReady(), so the reveal never
started and the old wallpaper stayed up. Both frames now drop the twin on
Image.Error and bind the plain file, as the base frame already did.
Comment on lines +1 to +5
#!/bin/bash

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 New suite breaks test rules

This adds a separate test suite even though background-pending-theme-test.sh already tests this plugin’s reveals and video-background-test.sh tests its snapshots. The repository requires extending an existing test file for the area rather than adding another *-test.sh. Move these checks into those existing suites before merging.

File Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants