From cc84ab2289381038f483f06963374aa0247f6724 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 2 Sep 2025 20:56:37 +0200 Subject: ... --- .../shell/quickshell/WallpaperBackground.qml | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 accounts/gkleen@sif/shell/quickshell/WallpaperBackground.qml (limited to 'accounts/gkleen@sif/shell/quickshell/WallpaperBackground.qml') diff --git a/accounts/gkleen@sif/shell/quickshell/WallpaperBackground.qml b/accounts/gkleen@sif/shell/quickshell/WallpaperBackground.qml new file mode 100644 index 00000000..de31915f --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/WallpaperBackground.qml @@ -0,0 +1,85 @@ +import QtQuick +import Quickshell +import qs.Services + +Item { + id: root + + anchors.fill: parent + + required property string screen + + property Img current: one + property string source: selector.selected + + WallpaperSelector { + id: selector + seed: screen + } + + onSourceChanged: { + if (!source) + current = null; + else if (current === one) + two.update() + else + one.update() + } + + Img { id: one } + Img { id: two } + + component Img: Image { + id: img + + function update() { + source = root.source || "" + } + + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + smooth: true + asynchronous: true + cache: false + + opacity: 0 + + onStatusChanged: { + if (status === Image.Ready) { + root.current = this + } + } + + states: State { + name: "visible" + when: root.current === img + + PropertyChanges { + img.opacity: 1 + } + StateChangeScript { + name: "unloadOther" + script: { + if (img === one) + two.source = "" + if (img === two) + one.source = "" + } + } + } + + transitions: Transition { + SequentialAnimation { + NumberAnimation { + target: img + properties: "opacity" + duration: 5000 + easing.type: Easing.OutCubic + } + ScriptAction { + scriptName: "unloadOther" + } + } + } + } +} -- cgit v1.2.3