feat: add req handler

This commit is contained in:
tux
2025-06-18 06:16:54 +05:30
parent 3e38dab8b9
commit da9f8406a5
2 changed files with 17 additions and 1 deletions

14
handler.ts Normal file
View File

@@ -0,0 +1,14 @@
import { App } from "astal/gtk4";
import { WINDOW_NAME } from "./widgets/bar";
export const reqHandler = (req: string, res: (res: any) => void) => {
switch (req) {
case "toggle-bar":
const win = App.get_window(WINDOW_NAME);
win?.is_visible() ? win.hide() : win?.set_visible(true);
break;
default:
res("uknown command");
}
};