From c37ef867a1fdd1bf707eb2d21c75400088d5239e Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Fri, 29 Aug 2025 12:41:37 -0400 Subject: [PATCH] Wallpaper: delay service initialization until settings are ready --- Commons/Settings.qml | 18 ++++++++---------- Modules/Background/Background.qml | 5 ++--- Modules/Background/Overview.qml | 5 ++--- Services/MatugenService.qml | 1 - 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 917707b..c4f11b7 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -89,18 +89,16 @@ Singleton { reload() } onLoaded: function () { - 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") + if (!isLoaded) { + Logger.log("Settings", "----------------------------") + Logger.log("Settings", "Settings loaded successfully") + isLoaded = true - // Validate monitor configurations, only once - // if none of the configured monitors exist, clear the lists + Qt.callLater(function () { + // Some stuff like settings validation should just be executed once on startup and not on every reload validateMonitorConfigurations() - - isLoaded = true - } - }) + }) + } } onLoadFailed: function (error) { if (error.toString().includes("No such file") || error === 2) diff --git a/Modules/Background/Background.qml b/Modules/Background/Background.qml index f4e9dd4..ef6cd39 100644 --- a/Modules/Background/Background.qml +++ b/Modules/Background/Background.qml @@ -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 diff --git a/Modules/Background/Overview.qml b/Modules/Background/Overview.qml index e53f8b5..32237d1 100644 --- a/Modules/Background/Overview.qml +++ b/Modules/Background/Overview.qml @@ -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 diff --git a/Services/MatugenService.qml b/Services/MatugenService.qml index dd8be4a..939324b 100644 --- a/Services/MatugenService.qml +++ b/Services/MatugenService.qml @@ -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"