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