diff --git a/home/ags/files/Bar.tsx b/home/ags/files/Bar.tsx
index bbdd9b0d..98c37932 100644
--- a/home/ags/files/Bar.tsx
+++ b/home/ags/files/Bar.tsx
@@ -1,11 +1,15 @@
-import { App, Astal, Gdk, Gtk, Widget } from "astal/gtk3";
-import { GLib, Variable, bind } from "astal";
+import { Astal, Gdk } from "ags/gtk4";
+import app from "ags/gtk4/app"
+import Gtk from "gi://Gtk?version=4.0"
+import { createBinding, createState, For, With, Accessor } from "ags"
+import { createPoll } from "ags/time"
import Tray from "gi://AstalTray";
-import { execAsync } from "astal/process"
+import { execAsync } from "ags/process"
import Hyprland from "gi://AstalHyprland";
import { getIconName } from "./utils";
import Wp from "gi://AstalWp"
import Battery from "gi://AstalBattery"
+import GLib from "gi://GLib";
const battery = Battery.get_default()
const sensorsAvailable = await execAsync(['sensors']).then(() => true).catch(() => false);
@@ -13,28 +17,35 @@ const wirePlumber = Wp.get_default();
function SysTray(): JSX.Element {
const tray = Tray.get_default();
+ let items = createBinding(tray, "items");
+ const init = (btn: Gtk.MenuButton, item: Tray.TrayItem) => {
+ btn.menuModel = item.menuModel
+ btn.insert_action_group("dbusmenu", item.actionGroup)
+ item.connect("notify::action-group", () => {
+ btn.insert_action_group("dbusmenu", item.actionGroup)
+ })
+ }
return (
- {bind(tray, "items").as((items) =>
- items.map((item) => {
- if (item.iconThemePath) App.add_icons(item.iconThemePath);
+
+ {(item: Tray.TrayItem) => {
+ if (item.iconThemePath) app.add_icons(item.iconThemePath);
return (
["dbusmenu", ag])}
- menuModel={bind(item, "menuModel")}>
-
+ $={(self) => init(self, item)}
+ class="systray"
+ tooltipMarkup={createBinding(item, "tooltipMarkup")}
+ menuModel={createBinding(item, "menuModel")}>
+
);
- }),
- )}
+ }}
+
);
}
-function Left() : JSX.Element {
+function Left(): JSX.Element {
return (
@@ -42,7 +53,7 @@ function Left() : JSX.Element {
);
}
-function Center() : JSX.Element {
+function Center(): JSX.Element {
return (
@@ -51,85 +62,77 @@ function Center() : JSX.Element {
}
function Date({ format = "%Y-%m-%d" }): JSX.Element {
- const time = Variable("").poll(60000, () =>
- GLib.DateTime.new_now_local().format(format)!)
+ const time = createPoll("", 60000, () => GLib.DateTime.new_now_local().format(format)!)
return