diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-05 17:37:43 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-05 17:37:43 +1100 |
| commit | d46b36860666583cd9645bfb1fa28d807973c324 (patch) | |
| tree | 97148da2ccf623491f5bdef5e998fb54e4574d52 /src/services/palette.ts | |
| parent | app: init services after timeout (diff) | |
| download | caelestia-shell-d46b36860666583cd9645bfb1fa28d807973c324.tar.gz caelestia-shell-d46b36860666583cd9645bfb1fa28d807973c324.tar.bz2 caelestia-shell-d46b36860666583cd9645bfb1fa28d807973c324.zip | |
schemes: update for scripts refactor
Diffstat (limited to 'src/services/palette.ts')
| -rw-r--r-- | src/services/palette.ts | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/services/palette.ts b/src/services/palette.ts index 7f6dc0c..da7ef09 100644 --- a/src/services/palette.ts +++ b/src/services/palette.ts @@ -41,18 +41,24 @@ export default class Palette extends GObject.Object { return this.instance; } - #isLight: boolean; - #name: string; + #mode: "light" | "dark"; + #scheme: string; + #flavour?: string; #colours!: IPalette; @property(Boolean) - get isLight() { - return this.#isLight; + get mode() { + return this.#mode; } @property(String) - get name() { - return this.#name; + get scheme() { + return this.#scheme; + } + + @property(String) + get flavour() { + return this.#flavour; } @property(Object) @@ -246,16 +252,17 @@ export default class Palette extends GObject.Object { constructor() { super(); - this.#isLight = readFile(`${STATE}/scheme/current-mode.txt`) === "light"; + this.#mode = readFile(`${STATE}/scheme/current-mode.txt`) === "light" ? "light" : "dark"; monitorFile(`${STATE}/scheme/current-mode.txt`, async file => { - this.#isLight = (await readFileAsync(file)) === "light"; - this.notify("is-light"); + this.#mode = (await readFileAsync(file)) === "light" ? "light" : "dark"; + this.notify("mode"); }); - this.#name = readFile(`${STATE}/scheme/current-name.txt`); + [this.#scheme, this.#flavour] = readFile(`${STATE}/scheme/current-name.txt`).split("-"); monitorFile(`${STATE}/scheme/current-name.txt`, async file => { - this.#name = await readFileAsync(file); - this.notify("name"); + [this.#scheme, this.#flavour] = (await readFileAsync(file)).split("-"); + this.notify("scheme"); + this.notify("flavour"); }); this.update(); |