From b2f1d8fd9e440e75425f91ebd1df6a7f8d7cab4c Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sat, 19 Apr 2025 18:20:32 +0200 Subject: [PATCH] [AGS] Bar progress --- config/astal/app.ts | 28 ++--- config/astal/components/bar/ui/Bar.tsx | 31 +++-- .../components/bar/ui/modules/Calendar.tsx | 17 +++ .../components/bar/ui/modules/Hyprland.tsx | 8 +- .../components/bar/ui/modules/QuickView.tsx | 106 ++++++++++++++++++ .../astal/components/bar/util/brightness.ts | 71 ++++++++++++ config/astal/components/bar/util/hyprland.ts | 68 ----------- .../components/notifications/handler.tsx | 27 ++++- 8 files changed, 249 insertions(+), 107 deletions(-) create mode 100644 config/astal/components/bar/util/brightness.ts delete mode 100644 config/astal/components/bar/util/hyprland.ts diff --git a/config/astal/app.ts b/config/astal/app.ts index df44317..11f5328 100644 --- a/config/astal/app.ts +++ b/config/astal/app.ts @@ -2,38 +2,24 @@ import { App } from "astal/gtk3" import style from "./style.scss" import notifications from "./components/notifications/handler"; +import Bar from "./components/bar/ui/Bar"; App.start({ instanceName: "runner", css: style, main() { - notifications.startNotificationHandler( 0, App.get_monitors()[0] ) + notifications.startNotificationHandler( 0, App.get_monitors()[0] ); + // TODO: Monitor handling + Bar.Bar( App.get_monitors()[0] ); }, requestHandler(request, res) { const args = request.trimStart().split( ' ' ); - // Notifications + // Notifications (TODO: Handle the arguments in the components themselves) if ( args[ 0 ] === 'notifier' ) { - if ( args[ 1 ] == 'show' ) { - notifications.openNotificationMenu( 0 ); - res( 'Showing all open notifications' ); - } else if ( args[ 1 ] == 'hide' ) { - notifications.closeNotificationMenu( 0 ); - res( 'Hid all notifications' ); - } else if ( args[ 1 ] == 'clear' ) { - notifications.clearAllNotifications( 0 ); - res( 'Cleared all notifications' ); - } else if ( args[ 1 ] == 'clear-newest' ) { - notifications.clearNewestNotifications( 0 ); - res( 'Cleared newest notification' ); - } else if ( args[ 1 ] == 'toggle' ) { - notifications.toggleNotificationMenu( 0 ); - res( 'Toggled notifications' ); - } else { - res( 'Unknown command!' ); - } + res( notifications.cliHandler( args ) ); } else if ( args[ 0 ] === 'bar' ) { - + res( Bar.cliHandler( args ) ); } }, }) diff --git a/config/astal/components/bar/ui/Bar.tsx b/config/astal/components/bar/ui/Bar.tsx index 97be98e..aa55679 100644 --- a/config/astal/components/bar/ui/Bar.tsx +++ b/config/astal/components/bar/ui/Bar.tsx @@ -1,23 +1,36 @@ -import { createQuickActionsMenu } from "./QuickActions"; -import { GLib } from "astal"; import { Astal, Gdk, Gtk } from "astal/gtk3"; +import Hyprland from "./modules/Hyprland"; +import Calendar from "./modules/Calendar"; +import QuickView from "./modules/QuickView"; const Bar = (gdkmonitor: Gdk.Monitor) => { + const { TOP, LEFT, RIGHT } = Astal.WindowAnchor; return ( + cssClasses={["Bar"]} + exclusivity={Astal.Exclusivity.EXCLUSIVE} + anchor={TOP | LEFT | RIGHT}> - + + + - - - -