Bug 527150 - Image wallpaper falls back to default on one screen: replaceWhenLoaded() treats Image.Loading after StackView.replace() as failure
Summary: Image wallpaper falls back to default on one screen: replaceWhenLoaded() trea...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Image & Slideshow wallpaper plugins (other bugs)
Version First Reported In: 6.8.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
: 527100 527167 527592 527909 (view as bug list)
Depends on:
Blocks:
 
Reported: 2026-10-15 21:45 UTC by Rafael
Modified: 2026-10-27 22:08 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.8.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael 2026-10-15 21:45:22 UTC
With a wallpaper package configured (e.g. Image=file:///usr/share/wallpapers/Mountain/),
the lock screen shows the default wallpaper (Next) on one of two screens, while the
other screen shows the configured wallpaper. A direct image file URL works on both.

STEPS TO REPRODUCE

1. Two monitors: DP-1 2560x1440 with fractional scaling (logical 2048x1152),
   HDMI-A-1 with logical size 1080x1920.
2. In kscreenlockerrc set:
     [Greeter][Wallpaper][org.kde.image][General]
     Image=file:///usr/share/wallpapers/Mountain/
3. Run /usr/lib/kscreenlocker_greet --testing

OBSERVED: DP-1 shows Next (dark variant), HDMI-A-1 shows Mountain.
Reproducible in almost every run (correct once in ~10 attempts).

EXPECTED: Mountain on both screens.

ANALYSIS

I added logging to ImageStackView.qml, replaceWhenLoaded(), right before
view.replace() and right before the fallback check:

    before replace: status 1 (Ready)
    after replace:  2048 1152 QSizeF(4096, 2304) status 2 (Loading)
                    .../Mountain/contents/images_dark/5120x2880.png?<ts>
    -> then loads .../Next/contents/images_dark/5120x2880.png

The image has finished loading (Ready) when replaceWhenLoaded() runs.
view.replace(pendingImage, ...) then triggers a reload on this screen, so the
status goes back to Loading. The following check

    if (pendingImage.status !== Image.Ready)

then calls mediaProxy.useSingleImageDefaults(), which permanently replaces the
source with the default wallpaper although nothing failed. With a direct file
URL the status apparently stays Ready, so the bug does not show.

Changing the check to

    if (pendingImage.status === Image.Error || pendingImage.status === Image.Null)

fixes it reliably for me (3/3 runs, both screens correct).

SUGGESTED FIX

Base the fallback decision on the status before replace():

    -        view.replace(pendingImage, {}, QQC2.StackView.Transition);
    +        const loadSucceeded = pendingImage.status === Image.Ready;
    +        view.replace(pendingImage, {}, QQC2.StackView.Transition);

             wallpaperInterface.loading = false;

    -        if (pendingImage.status !== Image.Ready) {
    +        if (!loadSucceeded) {
                 mediaProxy.useSingleImageDefaults();
             }

Why replace() causes a reload on the fractionally scaled screen (sourceSize
4096x2304 vs. logical 2048x1152) may be a separate issue.

SYSTEM

Arch Linux, Plasma 6.8.0 (plasma-workspace 6.8.0-1, kscreenlocker 6.8.0-1),
Wayland, NVIDIA RTX 5070 Ti, Qt <version>, DP-1 scale <scale>
Comment 1 Rafael 2026-10-15 21:47:00 UTC
Missing system info from the description:

Qt 6.12.0 (qt6-base 6.12.0-3, qt6-declarative 6.12.0-1.1)
Output scales: DP-1 1.25 (the affected screen), HDMI-A-1 1.0
Comment 2 ekkotuz 2026-10-19 08:57:18 UTC
Confirming on a second setup. The reload is not specific to fractional scaling.

Setup: Arch Linux, Plasma 6.8.0 (plasma-workspace 6.8.0-1, kscreenlocker 6.8.0-1, kwin 6.8.0-1), Qt 6.12.0, Wayland, NVIDIA RTX 5060 Ti (nvidia-open 615.78.08). Two outputs, both at scale 1.0: 2560x1440 and 1440x2560 (rotated). Lock screen wallpaper: Image=file:///usr/share/wallpapers/Horos/. The real lock screen showed Next (dark) on the primary screen.

Reproducer that needs no special hardware (nested virtual KWin, two identical outputs, scale 1):

    dbus-run-session -- kwin_wayland --virtual --output-count 2 --width 1280 --height 720 \
        --socket wl-lktest --no-lockscreen \
        --exit-with-session '/usr/lib/kscreenlocker_greet --testing'

5 of 6 runs showed Next on both screens instead of the configured package.

Why replace() restarts loading: the wallpaper item is first laid out at LockScreen.qml's implicit size (800x600), before the root item is resized to the view. TransientImage finishes loading at 800x600, then StackView.replace() resizes it to the screen size, and TransientImage::geometryChange() -> refresh() -> load() starts a new reader and sets the status back to Loading. Logging in replaceWhenLoaded():

    before replace status= 1 size= 800x600 view= 1280x720
    after replace status= 2 size= 1280x720
    -> loadImage src= file:///usr/share/wallpapers/Next/ model= .../Next/contents/images_dark/5120x2880.png

So any size change between load completion and replace() triggers it. Fractional scaling is one way to get there. Whether it shows depends on whether the decode finishes before the root item is resized, which is why it varies per screen and per run.

Not treating Loading as a failure (status !== Image.Ready && status !== Image.Loading; the loadSucceeded change suggested above should behave the same) fixed it here: 5/5 runs of the reproducer, and the real lock screen, showed the configured wallpaper on both screens.
Comment 3 Adel Ailane 2026-10-20 09:43:56 UTC
Confirming on a third setup.

Arch Linux, Plasma 6.8.0 (plasma-workspace 6.8.0-1, kscreenlocker 6.8.0, kwin 6.8.0-1), Qt 6.12.0 (qt6-declarative 6.12.0-1), Wayland. Two outputs, both at scale 1: eDP-1 1920x1200 and DP-6 1920x1080.

Lock screen wallpaper: Image=file:///usr/share/wallpapers/Elarun/. Both screens show Next (dark) instead. Sometimes Elarun appears briefly before it's replaced.

Logging in replaceWhenLoaded() right before the fallback check, under kscreenlocker_greet --testing:

status= 2 src= file:///usr/share/wallpapers/Elarun/contents/images/2560x1600.png?<ts> size= QSizeF(1920, 1200)
status= 2 src= file:///usr/share/wallpapers/Elarun/contents/images/2560x1600.png?<ts> size= QSizeF(1920, 1080)
-> source then switches to file:///usr/share/wallpapers/Next/ while configuration.Image is still Elarun

So Loading is treated as failure, as described above. No fractional scaling is involved here either.

Workaround confirmed: pointing Image at the image file (file:///usr/share/wallpapers/Elarun/contents/images/2560x1600.png) instead of the package directory shows Elarun on both screens.
Comment 4 Marco Martin 2026-10-20 13:38:47 UTC
*** Bug 527167 has been marked as a duplicate of this bug. ***
Comment 5 Marco Martin 2026-10-20 13:57:35 UTC
(In reply to Rafael from comment #0)
> Why replace() causes a reload on the fractionally scaled screen (sourceSize
> 4096x2304 vs. logical 2048x1152) may be a separate issue.

Good catch. replace() causes the image to go inside the StackView, which it can resize the Image element. i suspect this might change the SourceSize as well, causing the image to reload (documented quirk of sourceSize)
Comment 6 Marco Martin 2026-10-20 14:38:26 UTC
can't quite reproduce tho
Comment 7 Marco Martin 2026-10-20 14:54:22 UTC
ok, scratch that, i happens to me as well, just with some packages and not others.

the diagnosis is still correct, it's dure to a resize from the image now being loaded in the stackview. it uses TransientImage instead of plain qml Image (a component that doesn't keep the image in ram, only in vram)

and that one of course has to reload the image every time is resized, that's why it goes back into the loading state
Comment 8 Bug Janitor Service 2026-10-20 15:06:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/7262
Comment 9 Nate Graham 2026-10-20 20:04:17 UTC
*** Bug 527100 has been marked as a duplicate of this bug. ***
Comment 10 Marco Martin 2026-10-21 13:13:43 UTC
Git commit 2ab8dcd8a7f811d14bb9d2494739151a3b26f8fb by Marco Martin.
Committed on 21/10/2026 at 12:22.
Pushed by mart into branch 'master'.

Image wallpaper: Make all image packages correctly load

ImageStackView in replaceWhenLoaded pushes pendingImage in the
StackView. This can resize it, and if pendingImage is a TransientImage it will be reloaded
every time it's resized.
use the status before pushing to actually check.

we should also eventually pay more attention to never ever resize those items
as it can cause unnecessary computation

M  +3    -1    wallpapers/image/imagepackage/contents/ui/ImageStackView.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/2ab8dcd8a7f811d14bb9d2494739151a3b26f8fb
Comment 11 Marco Martin 2026-10-21 14:22:45 UTC
Git commit 2cbeb4f9f0fe8e912a65d3420e27f9c0c17fa8e2 by Marco Martin.
Committed on 21/10/2026 at 14:12.
Pushed by mart into branch 'Plasma/6.8'.

Image wallpaper: Make all image packages correctly load

ImageStackView in replaceWhenLoaded pushes pendingImage in the
StackView. This can resize it, and if pendingImage is a TransientImage it will be reloaded
every time it's resized.
use the status before pushing to actually check.

we should also eventually pay more attention to never ever resize those items
as it can cause unnecessary computation

M  +3    -1    wallpapers/image/imagepackage/contents/ui/ImageStackView.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/2cbeb4f9f0fe8e912a65d3420e27f9c0c17fa8e2
Comment 12 Niccolò Venerandi 2026-10-22 11:21:53 UTC
*** Bug 527592 has been marked as a duplicate of this bug. ***
Comment 13 Niccolò Venerandi 2026-10-27 22:08:48 UTC
*** Bug 527909 has been marked as a duplicate of this bug. ***