Wallpaper: minor improvements

This commit is contained in:
LemmyCook 2025-09-03 17:51:02 -04:00
parent 65f73bb1ba
commit 3ba6899e69
2 changed files with 20 additions and 22 deletions

View file

@ -104,8 +104,7 @@ Variants {
mipmap: false mipmap: false
visible: false visible: false
cache: false cache: false
// currentWallpaper should not be asynchronous to avoid flickering when swapping next to current. asynchronous: true
asynchronous: false
} }
Image { Image {
@ -236,12 +235,9 @@ Variants {
currentWallpaper.source = nextWallpaper.source currentWallpaper.source = nextWallpaper.source
nextWallpaper.source = "" nextWallpaper.source = ""
transitionProgress = 0.0 transitionProgress = 0.0
} Qt.callLater(() => {
} currentWallpaper.asynchronous = true
}, 100)
function startTransition() {
if (!transitioning && nextWallpaper.source != currentWallpaper.source) {
transitionAnimation.start()
} }
} }
@ -253,19 +249,21 @@ Variants {
} }
function setWallpaperWithTransition(source) { function setWallpaperWithTransition(source) {
if (source != currentWallpaper.source) { if (source === currentWallpaper.source) {
return
if (transitioning) {
// We are interrupting a transition
transitionAnimation.stop()
transitionProgress = 0
currentWallpaper.source = nextWallpaper.source
nextWallpaper.source = ""
}
nextWallpaper.source = source
startTransition()
} }
if (transitioning) {
// We are interrupting a transition
transitionAnimation.stop()
transitionProgress = 0
currentWallpaper.source = nextWallpaper.source
nextWallpaper.source = ""
}
nextWallpaper.source = source
currentWallpaper.asynchronous = false
transitionAnimation.start()
} }
// Main method that actually trigger the wallpaper change // Main method that actually trigger the wallpaper change

View file

@ -139,8 +139,8 @@ ColumnLayout {
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
NSlider { NSlider {
Layout.fillWidth: true Layout.fillWidth: true
from: 100 from: 500
to: 5000 to: 10000
stepSize: 100 stepSize: 100
value: Settings.data.wallpaper.transitionDuration value: Settings.data.wallpaper.transitionDuration
onMoved: Settings.data.wallpaper.transitionDuration = value onMoved: Settings.data.wallpaper.transitionDuration = value