Wallpaper: delay service initialization until settings are ready

This commit is contained in:
LemmyCook 2025-08-29 12:41:37 -04:00
parent 7c6c908076
commit c37ef867a1
4 changed files with 12 additions and 17 deletions

View file

@ -89,19 +89,17 @@ Singleton {
reload()
}
onLoaded: function () {
if (!isLoaded) {
Logger.log("Settings", "----------------------------")
Logger.log("Settings", "Settings loaded successfully")
isLoaded = true
Qt.callLater(function () {
// Some stuff like settings validation should just be executed once on startup and not on every reload
if (!isLoaded) {
Logger.log("Settings", "JSON completed loading")
// Validate monitor configurations, only once
// if none of the configured monitors exist, clear the lists
validateMonitorConfigurations()
isLoaded = true
}
})
}
}
onLoadFailed: function (error) {
if (error.toString().includes("No such file") || error === 2)
// File doesn't exist, create it with default values

View file

@ -10,9 +10,8 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
property string wallpaperSource: WallpaperService.getWallpaper(modelData.name)
active: wallpaperSource !== ""
active: Settings.isLoaded && WallpaperService.getWallpaper(modelData.name)
sourceComponent: PanelWindow {
@ -32,7 +31,7 @@ Variants {
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
source: WallpaperService.getWallpaper(modelData.name)
cache: true
smooth: true
mipmap: false

View file

@ -11,9 +11,8 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
property string wallpaperSource: WallpaperService.getWallpaper(modelData.name)
active: CompositorService.isNiri && wallpaperSource !== ""
active: Settings.isLoaded && CompositorService.isNiri
sourceComponent: PanelWindow {
Component.onCompleted: {
@ -37,7 +36,7 @@ Variants {
id: bgImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
source: WallpaperService.getWallpaper(modelData.name)
cache: true
smooth: true
mipmap: false

View file

@ -22,7 +22,6 @@ Singleton {
// Ensure cache dir exists
Quickshell.execDetached(["mkdir", "-p", Settings.cacheDir])
// TODO: fix matugen
var content = buildConfigToml()
var mode = Settings.data.colorSchemes.darkMode ? "dark" : "light"