diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-27 21:35:48 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-27 21:35:48 +1100 |
| commit | 88547233e24876958799e73dbd34d8df0dadee97 (patch) | |
| tree | 20ed3c86369bf4ef35738fa423482c0ff874b279 /src/config/funcs.ts | |
| parent | bar: change onclick to sidebar (diff) | |
| download | caelestia-shell-88547233e24876958799e73dbd34d8df0dadee97.tar.gz caelestia-shell-88547233e24876958799e73dbd34d8df0dadee97.tar.bz2 caelestia-shell-88547233e24876958799e73dbd34d8df0dadee97.zip | |
launcher: transparency action
Diffstat (limited to 'src/config/funcs.ts')
| -rw-r--r-- | src/config/funcs.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/config/funcs.ts b/src/config/funcs.ts index 473c502..93a8ef5 100644 --- a/src/config/funcs.ts +++ b/src/config/funcs.ts @@ -1,4 +1,4 @@ -import { GLib, monitorFile, readFileAsync, Variable } from "astal"; +import { GLib, monitorFile, readFileAsync, Variable, writeFileAsync } from "astal"; import config from "."; import { loadStyleAsync } from "../../app"; import defaults from "./defaults"; @@ -92,3 +92,11 @@ export const initConfig = () => { monitorFile(CONFIG, () => updateConfig().catch(e => console.warn(`Invalid config: ${e}`))); updateConfig().catch(e => console.warn(`Invalid config: ${e}`)); }; + +export const setConfig = async (path: string, value: any) => { + const conf = JSON.parse(await readFileAsync(CONFIG)); + let obj = conf; + for (const p of path.split(".").slice(0, -1)) obj = obj[p]; + obj[path.split(".").at(-1)!] = value; + await writeFileAsync(CONFIG, JSON.stringify(conf, null, 4)); +}; |