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