From 751ad07e151f0abfd111c4d800d172f726ffa33c Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Wed, 15 Jan 2025 20:58:01 +1100
Subject: brightness and volume osds

---
 app.tsx | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(limited to 'app.tsx')

diff --git a/app.tsx b/app.tsx
index e38c352..ee2c549 100644
--- a/app.tsx
+++ b/app.tsx
@@ -1,9 +1,10 @@
 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 Osds from "./modules/osds";
+import Monitors from "./services/monitors";
 import Players from "./services/players";
 
 const loadStyleAsync = async () => {
@@ -21,21 +22,24 @@ App.start({
 
         <Launcher />;
         <NotifPopups />;
-        AstalHyprland.get_default().monitors.forEach(m => <Bar monitor={m} />);
+        Monitors.get_default().forEach(m => {
+            <Osds monitor={m} />;
+            <Bar monitor={m} />;
+        });
 
         console.log("Caelestia started");
     },
     requestHandler(request, res) {
-        let log = true;
-
         if (request === "reload css") loadStyleAsync().catch(console.error);
         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();
+        else if (request === "brightness up") Monitors.get_default().active.brightness += 0.1;
+        else if (request === "brightness down") Monitors.get_default().active.brightness -= 0.1;
         else return res("Unknown command: " + request);
 
-        if (log) console.log(`Request handled: ${request}`);
+        console.log(`Request handled: ${request}`);
         res("OK");
     },
 });
-- 
cgit v1.2.3-freya

