fix(ags notif center): make first notif appear correctly

This commit is contained in:
matt1432 2023-11-07 11:09:16 -05:00
parent 80427166f5
commit ee5af67444

View file

@ -22,26 +22,18 @@ const addNotif = (box, notif) => {
}
};
// FIXME: first notif never works
const NotificationList = () => Box({
vertical: true,
vexpand: true,
vpack: 'start',
binds: [['visible', HasNotifs]],
setup: box => {
// Get cached notifications
const id = Notifications.connect('changed', () => {
Notifications.notifications.forEach(notif => {
addNotif(box, notif);
});
Notifications.disconnect(id);
});
},
connections: [
[Notifications, (box, id) => {
if (!id)
return;
// Handle cached notifs
if (box.children.length == 0)
Notifications.notifications.forEach(n => addNotif(box, n));
else if (id)
addNotif(box, Notifications.getNotification(id));
}, 'notified'],