summaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-02 13:14:54 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-02 13:14:54 +1100
commitdf3f93475ac3f04627be0918f5637cfc8cdec873 (patch)
tree0994f49839a39a9fea2c2754ee832d9cd4f8f64c /src/services
parentlauncher: wallpaper action (diff)
downloadcaelestia-shell-df3f93475ac3f04627be0918f5637cfc8cdec873.tar.gz
caelestia-shell-df3f93475ac3f04627be0918f5637cfc8cdec873.tar.bz2
caelestia-shell-df3f93475ac3f04627be0918f5637cfc8cdec873.zip
launcher: light/dark actions
For switching dynamic mode
Diffstat (limited to 'src/services')
-rw-r--r--src/services/palette.ts26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/services/palette.ts b/src/services/palette.ts
index b925d50..7f6dc0c 100644
--- a/src/services/palette.ts
+++ b/src/services/palette.ts
@@ -1,4 +1,4 @@
-import { GLib, GObject, monitorFile, property, readFile, register } from "astal";
+import { GLib, GObject, monitorFile, property, readFile, readFileAsync, register } from "astal";
export type Hex = `#${string}`;
@@ -41,8 +41,20 @@ export default class Palette extends GObject.Object {
return this.instance;
}
+ #isLight: boolean;
+ #name: string;
#colours!: IPalette;
+ @property(Boolean)
+ get isLight() {
+ return this.#isLight;
+ }
+
+ @property(String)
+ get name() {
+ return this.#name;
+ }
+
@property(Object)
get colours() {
return this.#colours;
@@ -234,6 +246,18 @@ export default class Palette extends GObject.Object {
constructor() {
super();
+ this.#isLight = readFile(`${STATE}/scheme/current-mode.txt`) === "light";
+ monitorFile(`${STATE}/scheme/current-mode.txt`, async file => {
+ this.#isLight = (await readFileAsync(file)) === "light";
+ this.notify("is-light");
+ });
+
+ this.#name = readFile(`${STATE}/scheme/current-name.txt`);
+ monitorFile(`${STATE}/scheme/current-name.txt`, async file => {
+ this.#name = await readFileAsync(file);
+ this.notify("name");
+ });
+
this.update();
monitorFile(`${STATE}/scheme/current.txt`, () => this.update());
}