From e923d39cdeed4b42e747afc01b3420d6d89af6e6 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Tue, 14 Jan 2025 00:22:59 +1100
Subject: app launcher

---
 app.tsx | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

(limited to 'app.tsx')

diff --git a/app.tsx b/app.tsx
index 27ca512..db766c8 100644
--- a/app.tsx
+++ b/app.tsx
@@ -2,7 +2,9 @@ import { execAsync, GLib, writeFileAsync } from "astal";
 import { App } from "astal/gtk3";
 import AstalHyprland from "gi://AstalHyprland";
 import Bar from "./modules/bar";
+import Launcher from "./modules/launcher";
 import NotifPopups from "./modules/notifpopups";
+import { PopupWindow } from "./utils/widgets";
 
 const loadStyleAsync = async () => {
     if (!GLib.file_test(`${SRC}/scss/scheme/_index.scss`, GLib.FileTest.EXISTS))
@@ -17,15 +19,25 @@ App.start({
     main() {
         loadStyleAsync().catch(console.error);
 
+        <Launcher />;
         <NotifPopups />;
         AstalHyprland.get_default().monitors.forEach(m => <Bar monitor={m} />);
 
         console.log("Caelestia started");
     },
     requestHandler(request, res) {
+        let log = true;
+
         if (request === "reload css") loadStyleAsync().catch(console.error);
-        else return res("Unknown command: " + request);
-        console.log(`Request handled: ${request}`);
+        else if (request.startsWith("toggle")) {
+            const window = App.get_window(request.slice(7));
+            if (window instanceof PopupWindow) window.toggle();
+            else App.toggle_window(request.slice(7));
+
+            log = false;
+        } else return res("Unknown command: " + request);
+
+        if (log) console.log(`Request handled: ${request}`);
         res("OK");
     },
 });
-- 
cgit v1.2.3-freya

