fix(ags notif center): make first notif appear correctly
This commit is contained in:
parent
80427166f5
commit
ee5af67444
1 changed files with 5 additions and 13 deletions
|
@ -22,27 +22,19 @@ 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));
|
||||
|
||||
addNotif(box, Notifications.getNotification(id));
|
||||
else if (id)
|
||||
addNotif(box, Notifications.getNotification(id));
|
||||
}, 'notified'],
|
||||
|
||||
[Notifications, (box, id) => {
|
||||
|
|
Loading…
Reference in a new issue