feat: close notification on right click (#386)

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
Rubin Bhandari
2024-10-28 13:16:44 +05:45
committed by GitHub
parent 5bc1c1e7d4
commit 41a8e44ffd

View File

@@ -55,21 +55,26 @@ export default (): Window<Box<Child, Attribute>, unknown> => {
const filteredNotifications = filterNotifications(notifications, ignoredNotifs);
return (self.children = filteredNotifications.slice(0, displayedTotal.value).map((notif) => {
return Widget.Box({
class_name: 'notification-card',
vpack: 'start',
hexpand: true,
children: [
Image(notif),
Widget.Box({
vpack: 'start',
vertical: true,
hexpand: true,
class_name: `notification-card-content ${!notifHasImg(notif) ? 'noimg' : ''}`,
children: [Header(notif), Body(notif), Action(notif, notifs)],
}),
CloseButton(notif, notifs),
],
return Widget.EventBox({
on_secondary_click: () => {
notifs.CloseNotification(notif.id);
},
child: Widget.Box({
class_name: 'notification-card',
vpack: 'start',
hexpand: true,
children: [
Image(notif),
Widget.Box({
vpack: 'start',
vertical: true,
hexpand: true,
class_name: `notification-card-content ${!notifHasImg(notif) ? 'noimg' : ''}`,
children: [Header(notif), Body(notif), Action(notif, notifs)],
}),
CloseButton(notif, notifs),
],
}),
});
}));
},