From cf55e2613314e27243c60395e58665b9309280c8 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Sat, 22 Feb 2025 19:58:07 +1100
Subject: config: use config file

Config file at ~/.config/caelestia/shell.json
---
 app.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'app.tsx')

diff --git a/app.tsx b/app.tsx
index 17bbeea..dd473d8 100644
--- a/app.tsx
+++ b/app.tsx
@@ -9,8 +9,9 @@ import Players from "@/services/players";
 import type PopupWindow from "@/widgets/popupwindow";
 import { execAsync, GLib, monitorFile, readFileAsync, writeFileAsync } from "astal";
 import { App } from "astal/gtk3";
+import { initConfig, updateConfig } from "config";
 
-const loadStyleAsync = async () => {
+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`);
@@ -33,6 +34,7 @@ App.start({
         const now = Date.now();
         loadStyleAsync().catch(console.error);
         monitorFile(`${STATE}/scheme/current.txt`, () => loadStyleAsync().catch(console.error));
+        initConfig();
 
         <Launcher />;
         <NotifPopups />;
@@ -46,6 +48,7 @@ App.start({
     requestHandler(request, res) {
         if (request === "quit") App.quit();
         else if (request === "reload-css") loadStyleAsync().catch(console.error);
+        else if (request === "reload-config") updateConfig();
         else if (request.startsWith("show")) App.get_window(request.split(" ")[1])?.show();
         else if (request === "toggle sideleft") {
             const window = App.get_window("sideleft") as PopupWindow | null;
-- 
cgit v1.2.3-freya

