2023-10-31 08:32:40 -04:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
|
|
|
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
|
|
|
|
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
2023-09-05 15:10:25 -04:00
|
|
|
|
2023-11-16 00:48:50 -05:00
|
|
|
import Separator from '../../misc/separator.js';
|
|
|
|
import EventBox from '../../misc/cursorbox.js';
|
2023-09-10 23:24:58 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
export default () => EventBox({
|
2023-10-20 23:11:21 -04:00
|
|
|
className: 'toggle-off',
|
|
|
|
onPrimaryClickRelease: () => App.toggleWindow('notification-center'),
|
|
|
|
connections: [[App, (self, windowName, visible) => {
|
|
|
|
if (windowName == 'notification-center')
|
|
|
|
self.toggleClassName('toggle-on', visible);
|
|
|
|
}]],
|
|
|
|
child: Box({
|
|
|
|
className: 'notif-panel',
|
|
|
|
vertical: false,
|
|
|
|
children: [
|
|
|
|
Separator(28),
|
2023-09-11 14:38:24 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
Icon({
|
|
|
|
connections: [[Notifications, self => {
|
|
|
|
if (Notifications.dnd) {
|
|
|
|
self.icon = 'notification-disabled-symbolic';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (Notifications.notifications.length > 0)
|
|
|
|
self.icon = 'notification-new-symbolic';
|
|
|
|
else
|
|
|
|
self.icon = 'notification-symbolic';
|
|
|
|
}
|
|
|
|
}]],
|
|
|
|
}),
|
2023-09-11 14:38:24 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
Separator(8),
|
2023-09-11 14:38:24 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
Label({
|
|
|
|
binds: [
|
|
|
|
['label', Notifications, 'notifications', n => String(n.length)],
|
|
|
|
],
|
|
|
|
}),
|
2023-09-11 14:38:24 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
],
|
|
|
|
}),
|
2023-09-05 15:10:25 -04:00
|
|
|
});
|