summaryrefslogtreecommitdiff
path: root/app.tsx
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-25 15:33:08 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-25 15:33:08 +1100
commit01626b70f10b38a6c03e5701283a43e9920fc26d (patch)
tree0042e856dc30df6760e81a245cac977b2abd3dd7 /app.tsx
parentlauncher: italic xwayland windows (diff)
downloadcaelestia-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.tsx21
1 files changed, 8 insertions, 13 deletions
diff --git a/app.tsx b/app.tsx
index dd473d8..0739d01 100644
--- a/app.tsx
+++ b/app.tsx
@@ -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 />;