From 8751acf68f7ea7748fda338940af02504c597122 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 17 Jan 2025 21:03:26 +1100 Subject: style: use system scheme if available --- app.tsx | 10 +++++++--- 1 file 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); }; -- cgit v1.2.3-freya