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,18 +89,16 @@ Singleton {
reload() reload()
} }
onLoaded: function () { onLoaded: function () {
Qt.callLater(function () { if (!isLoaded) {
// Some stuff like settings validation should just be executed once on startup and not on every reload Logger.log("Settings", "----------------------------")
if (!isLoaded) { Logger.log("Settings", "Settings loaded successfully")
Logger.log("Settings", "JSON completed loading") isLoaded = true
// Validate monitor configurations, only once Qt.callLater(function () {
// if none of the configured monitors exist, clear the lists // Some stuff like settings validation should just be executed once on startup and not on every reload
validateMonitorConfigurations() validateMonitorConfigurations()
})
isLoaded = true }
}
})
} }
onLoadFailed: function (error) { onLoadFailed: function (error) {
if (error.toString().includes("No such file") || error === 2) if (error.toString().includes("No such file") || error === 2)

View file

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

View file

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

View file

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