summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.tsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/app.tsx b/app.tsx
index 2a40258..3bebad0 100644
--- a/app.tsx
+++ b/app.tsx
@@ -1,4 +1,4 @@
-import { execAsync, GLib, writeFileAsync } from "astal";
+import { execAsync, GLib, readFileAsync, writeFileAsync } from "astal";
import { App } from "astal/gtk3";
import Bar from "./src/modules/bar";
import Launcher from "./src/modules/launcher";
@@ -9,8 +9,12 @@ import Monitors from "./src/services/monitors";
import Players from "./src/services/players";
const loadStyleAsync = async () => {
- if (!GLib.file_test(`${SRC}/scss/scheme/_index.scss`, GLib.FileTest.EXISTS))
- await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, '@forward "mocha";');
+ let scheme = "mocha";
+ if (GLib.file_test(`${CACHE}/scheme/current.txt`, GLib.FileTest.EXISTS)) {
+ const currentScheme = await readFileAsync(`${CACHE}/scheme/current.txt`);
+ if (GLib.file_test(`${SRC}/scss/scheme/${scheme}.scss`, GLib.FileTest.EXISTS)) scheme = currentScheme;
+ }
+ await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, `@forward "${scheme}";`);
App.apply_css(await execAsync(`sass ${SRC}/style.scss`), true);
};