feat(ags notifs): add blocked apps list

This commit is contained in:
matt1432 2023-09-19 10:22:08 -04:00
parent bbf96b34c5
commit d5a9b24de1
3 changed files with 107 additions and 89 deletions

View file

@ -73,7 +73,17 @@ const NotificationIcon = ({ appEntry, appIcon, image }) => {
}); });
}; };
export default ({ id, summary, body, actions, urgency, time, command = i => {}, ...icon }) => Draggable({ export default ({ id, summary, body, actions, urgency, time, command = i => {}, ...icon }) => {
const BlockedApps = [
'Spotify',
];
if (BlockedApps.find(app => app == Notifications.getNotification(id).appName)) {
Notifications.close(id);
return;
}
return Draggable({
maxOffset: 200, maxOffset: 200,
command: () => command(id), command: () => command(id),
properties: [ properties: [
@ -162,4 +172,5 @@ export default ({ id, summary, body, actions, urgency, time, command = i => {},
], ],
}), }),
}), }),
}); });
};

View file

@ -61,12 +61,16 @@ const NotificationList = () => Box({
.map(n => Notification({ ...n, command: i => Notifications.close(i), })); .map(n => Notification({ ...n, command: i => Notifications.close(i), }));
} }
else if (id) { else if (id) {
box.add(Notification({ const NewNotif = Notification({
...Notifications.getNotification(id), ...Notifications.getNotification(id),
command: i => Notifications.close(i), command: i => Notifications.close(i),
})); });
if (NewNotif) {
box.add(NewNotif);
box.show_all(); box.show_all();
} }
}
}, 'notified'], }, 'notified'],

View file

@ -31,6 +31,9 @@ const Popups = () => Box({
if (!id || Notifications.dnd) if (!id || Notifications.dnd)
return; return;
if (! Notifications.getNotification(id))
return;
box._map.delete(id); box._map.delete(id);
box._map.set(id, Notification({ box._map.set(id, Notification({