diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml index a56ff348..37b60667 100644 --- a/services/Wallpapers.qml +++ b/services/Wallpapers.qml @@ -13,6 +13,7 @@ Searcher { readonly property string currentNamePath: `${Paths.state}/wallpaper/path.txt` readonly property list smartArg: GlobalConfig.services.smartScheme ? [] : ["--no-smart"] + readonly property string fallback: Quickshell.shellPath("assets/wallpaper.webp") property bool showPreview: false readonly property string current: showPreview ? previewPath : actualCurrent @@ -76,11 +77,22 @@ Searcher { FileView { path: root.currentNamePath watchChanges: true + printErrors: false onFileChanged: reload() onLoaded: { - root.actualCurrent = text().trim(); + let wall = text().trim(); + if (!wall) { + wall = root.fallback; + Quickshell.execDetached(["caelestia", "wallpaper", "-f", root.fallback, ...root.smartArg]); + } + root.actualCurrent = wall; root.previewColourLock = false; } + onLoadFailed: { + root.actualCurrent = root.fallback; + root.previewColourLock = false; + Quickshell.execDetached(["caelestia", "wallpaper", "-f", root.fallback, ...root.smartArg]); + } } FileSystemModel {