use bindings

This commit is contained in:
Benjamin Palko 2025-04-08 00:15:34 -04:00
parent 98a3b5381e
commit ecc664bcaf

View file

@ -1,5 +1,5 @@
import { bind } from "astal";
import { Gdk, Gtk } from "astal/gtk4";
import { Gdk } from "astal/gtk4";
import AstalTray from "gi://AstalTray";
const Tray = function () {
@ -7,10 +7,6 @@ const Tray = function () {
const trayItems = bind(tray, "items");
function OpenTrayItem(button: Gtk.MenuButton, item: AstalTray.TrayItem) {
item.about_to_show();
}
return (
<box cssClasses={["Tray"]}>
{trayItems.as((items) =>
@ -18,8 +14,10 @@ const Tray = function () {
return (
<menubutton cursor={Gdk.Cursor.new_from_name("pointer", null)}>
<image
tooltip_text={item.title || item.tooltip.title}
file={item.iconName || "NONE"}
tooltip_text={bind(item, "tooltip_markup")}
file={bind(item, "icon_name").as(
(iconName) => iconName || "NONE",
)}
/>
</menubutton>
);