import { bind, timeout } from 'astal'; import { App, Gtk, Widget } from 'astal/gtk3'; import AstalNotifd from 'gi://AstalNotifd'; import { Notification, HasNotifs } from './notification'; import NotifGestureWrapper from './gesture'; const addNotif = (box: Widget.Box, notifObj: AstalNotifd.Notification) => { if (notifObj) { const NewNotif = Notification({ id: notifObj.id, slide_in_from: 'Right', }); if (NewNotif) { box.pack_end(NewNotif, false, false, 0); box.show_all(); } } }; const NotificationList = () => { const notifications = AstalNotifd.get_default(); return ( { notifications.get_notifications().forEach((n) => { addNotif(self, n); }); self .hook(notifications, 'notified', (_, id) => { if (id) { const notifObj = notifications.get_notification(id); if (notifObj) { addNotif(self, notifObj); } } }) .hook(notifications, 'resolved', (_, id) => { const notif = (self.get_children() as NotifGestureWrapper[]) .find((ch) => ch.id === id); if (notif?.sensitive) { notif.slideAway('Right'); } }); }} /> ); }; const ClearButton = () => { const notifications = AstalNotifd.get_default(); return ( hasNotifs ? 'pointer' : 'not-allowed')} > ); }; const Header = () => ( ); const Placeholder = () => ( !v)} > ); export default () => (
);