From f8f8b0837bad46e6b1f40ce6e8df3b45cf3c8542 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Mon, 31 Mar 2025 22:00:52 +1100
Subject: startup: wait for config to init

Also cleanup some stuff
---
 app.tsx | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

(limited to 'app.tsx')

diff --git a/app.tsx b/app.tsx
index 135dce8..23f4be9 100644
--- a/app.tsx
+++ b/app.tsx
@@ -2,7 +2,6 @@ import Bar from "@/modules/bar";
 import Launcher from "@/modules/launcher";
 import NotifPopups from "@/modules/notifpopups";
 import Osds from "@/modules/osds";
-import Popdowns from "@/modules/popdowns";
 import Session from "@/modules/session";
 import SideBar from "@/modules/sidebar";
 import Calendar from "@/services/calendar";
@@ -11,7 +10,6 @@ import Palette from "@/services/palette";
 import Players from "@/services/players";
 import Schemes from "@/services/schemes";
 import Wallpapers from "@/services/wallpapers";
-import type PopupWindow from "@/widgets/popupwindow";
 import { execAsync, idle, timeout, writeFileAsync } from "astal";
 import { App } from "astal/gtk3";
 import { style } from "config";
@@ -61,23 +59,22 @@ export const loadStyleAsync = () => styleLoader.run();
 App.start({
     instanceName: "caelestia",
     icons: "assets/icons",
-    main() {
+    async main() {
         const now = Date.now();
 
+        await initConfig();
+
         loadStyleAsync().catch(console.error);
         style.transparency.subscribe(() => loadStyleAsync().catch(console.error));
         Palette.get_default().connect("notify::colours", () => loadStyleAsync().catch(console.error));
         Palette.get_default().connect("notify::mode", () => loadStyleAsync().catch(console.error));
 
-        initConfig();
-
         <Launcher />;
         <NotifPopups />;
         <Osds />;
         <Session />;
         Monitors.get_default().forEach(m => <SideBar monitor={m} />);
         Monitors.get_default().forEach(m => <Bar monitor={m} />);
-        <Popdowns />;
 
         // Init services
         timeout(1000, () => {
@@ -89,23 +86,10 @@ App.start({
         console.log(`Caelestia started in ${Date.now() - now}ms`);
     },
     requestHandler(request, res) {
-        if (request === "quit") App.quit();
-        else if (request === "reload-css") loadStyleAsync().catch(console.error);
+        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;
-            if (window) {
-                if (window.visible) window.hide();
-                else window.popup_at_corner("top left");
-            }
-        } else if (request === "toggle sideright") {
-            const window = App.get_window("sideright") as PopupWindow | null;
-            if (window) {
-                if (window.visible) window.hide();
-                else window.popup_at_corner("top right");
-            }
-        } else if (request === "media play-pause") Players.get_default().lastPlayer?.play_pause();
+        else if (request === "media play-pause") Players.get_default().lastPlayer?.play_pause();
         else if (request === "media next") Players.get_default().lastPlayer?.next();
         else if (request === "media previous") Players.get_default().lastPlayer?.previous();
         else if (request === "media stop") Players.get_default().lastPlayer?.stop();
-- 
cgit v1.2.3-freya

