summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-07 14:58:58 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-07 14:58:58 +1000
commit5d5bea575836c4427619e68fb535d45390154b49 (patch)
treefcf150e02d2c304d4e82e0af8e9e76ace07d6c30
parentbar: add optional labels for workspaces (diff)
downloadcaelestia-shell-5d5bea575836c4427619e68fb535d45390154b49.tar.gz
caelestia-shell-5d5bea575836c4427619e68fb535d45390154b49.tar.bz2
caelestia-shell-5d5bea575836c4427619e68fb535d45390154b49.zip
config: handle config deleted
Revert to defaults if config file moved/deleted
-rw-r--r--src/config/funcs.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/config/funcs.ts b/src/config/funcs.ts
index fbfb88e..77ee8dd 100644
--- a/src/config/funcs.ts
+++ b/src/config/funcs.ts
@@ -100,7 +100,9 @@ const updateSection = (from: { [k: string]: any }, to: { [k: string]: any }, pat
};
export const updateConfig = async () => {
- updateSection(deepMerge(defaults, JSON.parse(await readFileAsync(CONFIG))), config);
+ if (GLib.file_test(CONFIG, GLib.FileTest.EXISTS))
+ updateSection(deepMerge(defaults, JSON.parse(await readFileAsync(CONFIG))), config);
+ else updateSection(defaults, config);
await loadStyleAsync();
console.log("[LOG] Config updated");
};