diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-06 17:44:16 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-06 17:44:16 +0100 |
| commit | f14d4ac615fe3ae62d77ed828b6150665a687033 (patch) | |
| tree | 1b8be5e1f2b7cce6212cc486215fe34e97ad3e11 /desktop/modules/appearance/WallpaperSpread.qml | |
| parent | df12ed91675a64afd0b0248d2487e9a94d860830 (diff) | |
| download | quickshell-f14d4ac615fe3ae62d77ed828b6150665a687033.tar.gz quickshell-f14d4ac615fe3ae62d77ed828b6150665a687033.zip | |
wallpaper: play the transition by name
Transitions.next() is asked once per run and the name goes out through
swapping, so both screens play the same effect, and the cover runs it
through WallShader, which the settings page's thumbnails will share.
progress is a plain 0 to 1 for every shader now; burn.frag keeps the
range it was tuned for by remapping it.
newImg gains a layer so it can be a shader's target: an Image sampled
directly gives the whole picture, not its PreserveAspectCrop crop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/appearance/WallpaperSpread.qml')
| -rw-r--r-- | desktop/modules/appearance/WallpaperSpread.qml | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/desktop/modules/appearance/WallpaperSpread.qml b/desktop/modules/appearance/WallpaperSpread.qml index 02e5f94..f9e484b 100644 --- a/desktop/modules/appearance/WallpaperSpread.qml +++ b/desktop/modules/appearance/WallpaperSpread.qml @@ -16,8 +16,8 @@ import QtQuick // The transition when Apply sets a wallpaper. swaybg has none: wallp kills // the old one and starts a new one, which can show a frame of nothing. A // surface on the bottom layer, above swaybg and below every window, covers -// the swap: the old picture burns away over the new one, and the -// surface goes once wallp has finished, by when the new swaybg is drawing +// the swap: the old picture gives way to the new one, through the transition +// Transitions picked, and the surface goes once wallp has finished, by when the new swaybg is drawing // the same picture underneath. Sets from a terminal get no transition: by // the time wall_h changes, swaybg has already swapped. Scope { @@ -34,6 +34,7 @@ Scope { property bool running: false property bool done: false property real progress: 0 + property string effect: "burn" property point origin: Qt.point(0.5, 0.5) visible: running @@ -47,12 +48,12 @@ Scope { Connections { target: Wallpapers - function onSwapping(which, from, to) { + function onSwapping(which, from, to, effect) { if (which !== win.modelData.which || !win.screen) return; anim.stop(); - // Behind the char band, so no pixel starts out scorched. - win.progress = -0.05; - // A different place each time the fire starts. + win.effect = effect; + win.progress = 0; + // A different place each time it starts. win.origin = Qt.point(Math.random(), Math.random()); win.done = false; oldImg.source = from; @@ -69,7 +70,7 @@ Scope { } } - // Both decoded before the first block drops, or the old one + // Both decoded before anything moves, or the old one // would pop in late over a half-drawn screen. readonly property bool ready: running && oldImg.status === Image.Ready && newImg.status === Image.Ready @@ -88,7 +89,7 @@ Scope { // -m fill is a centred crop, which is what PreserveAspectCrop does. // Both hidden until both are decoded: the new one usually lands // first, and drawn under an old one still loading it flashed - // the new picture before the burn. Until then the surface is + // the new picture before the transition. Until then the surface is // clear and swaybg shows the old picture itself. Image { id: newImg @@ -98,6 +99,8 @@ Scope { sourceSize: Qt.size(win.width, win.height) asynchronous: true cache: false + // A layer, so the shaders that read it get the crop. + layer.enabled: win.running } Image { @@ -109,11 +112,12 @@ Scope { asynchronous: true cache: false layer.enabled: win.running - layer.effect: ShaderEffect { - property real progress: win.progress - property real aspect: win.width / Math.max(1, win.height) - property point origin: win.origin - fragmentShader: Qt.resolvedUrl("burn.frag.qsb") + layer.effect: WallShader { + name: win.effect + target: newImg + progress: win.progress + aspect: win.width / Math.max(1, win.height) + origin: win.origin } } @@ -121,10 +125,10 @@ Scope { id: anim target: win property: "progress" - // Past 1: fbm can push a threshold a little over it. Linear, - // since an ease spends its slow ends where nothing burns. - to: 1.05 - duration: 3500 + // Linear, since an ease spends its slow ends where nothing + // happens. + to: 1 + duration: Transitions.duration easing.type: Easing.Linear onFinished: if (win.done) win.running = false } |
