import { bind } from "astal"; import { Gtk } from "astal/gtk4"; import Notifd from "gi://AstalNotifd"; import { urgency, createTimeoutManager } from "./notifd"; export const NotificationWidget = ({ n }: { n: Notifd.Notification }) => { const { START, CENTER } = Gtk.Align; const actions = n.actions || []; const TIMEOUT_DELAY = 3000; // Keep track of notification validity const timeoutManager = createTimeoutManager(() => n.dismiss(), TIMEOUT_DELAY); return ( { // Set up timeout timeoutManager.setupTimeout(); self.connect("unrealize", () => { timeoutManager.cleanup(); }); }} cssClasses={["notification", `${urgency(n)}`]} name={n.id.toString()} spacing={10} > {actions.length > 0 && ( {actions.map(({ label, id }) => ( ))} )} ); };