import { bind, timeout } from 'astal'; import { App, Gtk, Widget } from 'astal/gtk3'; import AstalNotifd from 'gi://AstalNotifd'; const Notifications = AstalNotifd.get_default(); 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 = () => ( { 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 = () => ( hasNotifs ? 'pointer' : 'not-allowed')} > ); const Header = () => ( ); const Placeholder = () => ( !v)} > ); export default () => (
);