Revert "Background: revert to old version which fixed the RAM issue"

This reverts commit b391d03967.
This commit is contained in:
Ly-sec
2025-10-03 14:49:31 +02:00
parent b391d03967
commit d2a5150f10
5 changed files with 91 additions and 126 deletions
+20 -30
View File
@@ -13,7 +13,7 @@ Variants {
required property ShellScreen modelData
active: Settings.isLoaded && modelData && Settings.data.wallpaper.enabled
active: modelData && Settings.data.wallpaper.enabled
sourceComponent: PanelWindow {
id: root
@@ -41,29 +41,10 @@ Variants {
property string futureWallpaper: ""
// Fillmode default is "crop"
property real fillMode: 1.0
property real fillMode: WallpaperService.getFillModeUniform()
property vector4d fillColor: Qt.vector4d(Settings.data.wallpaper.fillColor.r, Settings.data.wallpaper.fillColor.g, Settings.data.wallpaper.fillColor.b, 1.0)
// On startup, defer assigning wallpaper until the service cache is ready
function _startWallpaperOnceReady() {
if (!modelData) {
Qt.callLater(_startWallpaperOnceReady)
return
}
var cacheReady = WallpaperService && WallpaperService.currentWallpapers && Object.keys(WallpaperService.currentWallpapers).length > 0
if (!cacheReady) {
// Try again on the next tick until WallpaperService.init() populates cache
Qt.callLater(_startWallpaperOnceReady)
return
}
fillMode = WallpaperService.getFillModeUniform()
var path = WallpaperService.getWallpaper(modelData.name)
setWallpaperImmediate(path)
}
Component.onCompleted: _startWallpaperOnceReady()
Component.onCompleted: setWallpaperInitial()
Connections {
target: Settings.data.wallpaper
@@ -77,7 +58,6 @@ Variants {
target: WallpaperService
function onWallpaperChanged(screenName, path) {
if (screenName === modelData.name) {
// Update wallpaper display
// Set wallpaper immediately on startup
futureWallpaper = path
@@ -243,9 +223,7 @@ Variants {
easing.type: Easing.InOutCubic
onFinished: {
// Swap images after transition completes
if (currentWallpaper.source !== "") {
currentWallpaper.source = ""
}
currentWallpaper.source = ""
currentWallpaper.source = nextWallpaper.source
nextWallpaper.source = ""
transitionProgress = 0.0
@@ -255,12 +233,20 @@ Variants {
}
}
function setWallpaperInitial() {
// On startup, defer assigning wallpaper until the service cache is ready, retries every tick
if (!WallpaperService || !WallpaperService.isInitialized) {
Qt.callLater(setWallpaperInitial)
return
}
setWallpaperImmediate(WallpaperService.getWallpaper(modelData.name))
}
function setWallpaperImmediate(source) {
transitionAnimation.stop()
transitionProgress = 0.0
if (currentWallpaper.source !== "") {
currentWallpaper.source = ""
}
currentWallpaper.source = ""
currentWallpaper.source = source
nextWallpaper.source = ""
}
@@ -274,8 +260,12 @@ Variants {
// We are interrupting a transition
transitionAnimation.stop()
transitionProgress = 0
currentWallpaper.source = nextWallpaper.source
const newCurrentSource = nextWallpaper.source
currentWallpaper.source = ""
nextWallpaper.source = ""
currentWallpaper.source = newCurrentSource
}
nextWallpaper.source = source
+2 -2
View File
@@ -12,7 +12,7 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
active: CompositorService.isNiri && CompositorService.niriOverviewActive && modelData && Settings.data.wallpaper.enabled
active: CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
property string wallpaper: ""
@@ -37,7 +37,7 @@ Variants {
}
}
}
Connections {
target: WallpaperService
function onIsInitializedChanged() {