diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-23 17:54:22 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-23 17:54:22 +1100 |
| commit | ef675380a22521fb079486b0ca292fb662f7908b (patch) | |
| tree | b1f9e7b29182e0f1ce8edb6d5bb6c5231ad71181 | |
| parent | config: validate values (diff) | |
| download | caelestia-shell-ef675380a22521fb079486b0ca292fb662f7908b.tar.gz caelestia-shell-ef675380a22521fb079486b0ca292fb662f7908b.tar.bz2 caelestia-shell-ef675380a22521fb079486b0ca292fb662f7908b.zip | |
wallpapers: fix error on no paths
Also update on config change
| -rw-r--r-- | src/services/wallpapers.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/services/wallpapers.ts b/src/services/wallpapers.ts index 87a9c62..0e0e1de 100644 --- a/src/services/wallpapers.ts +++ b/src/services/wallpapers.ts @@ -56,6 +56,14 @@ export default class Wallpapers extends GObject.Object { ); const successes = results.filter(r => r.status === "fulfilled").map(r => r.value); + if (!successes.length) { + this.#list = []; + this.notify("list"); + this.#categories = []; + this.notify("categories"); + return; + } + const files = successes.map(r => r.files.replaceAll("\n", " ")).join(" "); const list = (await execAsync(["fish", "-c", `identify -ping -format '%i\n' ${files} ; true`])).split("\n"); @@ -81,6 +89,7 @@ export default class Wallpapers extends GObject.Object { .get() .map(p => monitorDirectory(p.path, () => this.update().catch(console.error), p.recursive)); config.paths.subscribe(v => { + this.update().catch(console.error); for (const m of monitors) m.cancel(); monitors = v.map(p => monitorDirectory(p.path, () => this.update().catch(console.error), p.recursive)); }); |