diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-02-25 15:33:08 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-02-25 15:33:08 +1100 |
| commit | 01626b70f10b38a6c03e5701283a43e9920fc26d (patch) | |
| tree | 0042e856dc30df6760e81a245cac977b2abd3dd7 /app.tsx | |
| parent | launcher: italic xwayland windows (diff) | |
| download | caelestia-shell-01626b70f10b38a6c03e5701283a43e9920fc26d.tar.gz caelestia-shell-01626b70f10b38a6c03e5701283a43e9920fc26d.tar.bz2 caelestia-shell-01626b70f10b38a6c03e5701283a43e9920fc26d.zip | |
updates: show arch news
Diffstat (limited to 'app.tsx')
| -rw-r--r-- | app.tsx | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -5,24 +5,17 @@ import Osds from "@/modules/osds"; import Popdowns from "@/modules/popdowns"; import Session from "@/modules/session"; import Monitors from "@/services/monitors"; +import Palette from "@/services/palette"; import Players from "@/services/players"; import type PopupWindow from "@/widgets/popupwindow"; -import { execAsync, GLib, monitorFile, readFileAsync, writeFileAsync } from "astal"; +import { execAsync, writeFileAsync } from "astal"; import { App } from "astal/gtk3"; import { initConfig, updateConfig } from "config"; export const loadStyleAsync = async () => { - let schemeColours; - if (GLib.file_test(`${STATE}/scheme/current.txt`, GLib.FileTest.EXISTS)) { - const currentScheme = await readFileAsync(`${STATE}/scheme/current.txt`); - schemeColours = currentScheme - .split("\n") - .map(l => { - const [name, hex] = l.split(" "); - return `$${name}: #${hex};`; - }) - .join("\n"); - } else schemeColours = await readFileAsync(`${SRC}/scss/scheme/_default.scss`); + const schemeColours = Object.entries(Palette.get_default().colours) + .map(([name, hex]) => `$${name}: ${hex};`) + .join("\n"); await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, schemeColours); App.apply_css(await execAsync(`sass ${SRC}/style.scss`), true); }; @@ -32,8 +25,10 @@ App.start({ icons: "assets/icons", main() { const now = Date.now(); + loadStyleAsync().catch(console.error); - monitorFile(`${STATE}/scheme/current.txt`, () => loadStyleAsync().catch(console.error)); + Palette.get_default().connect("notify::colours", () => loadStyleAsync().catch(console.error)); + initConfig(); <Launcher />; |