feat(ags notif center): close after clear all

This commit is contained in:
matt1432 2023-12-04 13:11:15 -05:00
parent 865d44223c
commit 9bdb2f44b4

View file

@ -1,6 +1,8 @@
import App from 'resource:///com/github/Aylur/ags/app.js';
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js'; import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
import { Button, Label, Box, Icon, Scrollable, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Button, Label, Box, Icon, Scrollable, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
import { Notification, HasNotifs } from './base.js'; import { Notification, HasNotifs } from './base.js';
import EventBox from '../misc/cursorbox.js'; import EventBox from '../misc/cursorbox.js';
@ -53,7 +55,10 @@ const NotificationList = () => Box({
// Needs to be wrapped to still have onHover when disabled // Needs to be wrapped to still have onHover when disabled
const ClearButton = () => EventBox({ const ClearButton = () => EventBox({
child: Button({ child: Button({
onPrimaryClickRelease: () => Notifications.clear(), onPrimaryClickRelease: () => {
Notifications.clear();
timeout(1000, () => App.closeWindow('notification-center'));
},
binds: [['sensitive', HasNotifs]], binds: [['sensitive', HasNotifs]],
child: Box({ child: Box({
children: [ children: [