Init Sequence: removed a bunch of no longer necessary Settings.isLoaded

This commit is contained in:
ItsLemmy
2025-09-29 09:11:37 -04:00
parent b8b54825d5
commit 9ed9231070
12 changed files with 34 additions and 44 deletions
+14 -23
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
@@ -254,6 +235,16 @@ 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()
@@ -324,4 +315,4 @@ Variants {
}
}
}
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
active: Settings.isLoaded && CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
active: CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
property string wallpaper: ""