2023-11-21 01:29:46 -05:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
2023-10-31 08:32:40 -04:00
|
|
|
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-10-31 08:32:40 -04:00
|
|
|
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
2023-09-05 15:10:25 -04:00
|
|
|
|
2023-11-21 01:29:46 -05:00
|
|
|
import EventBox from '../../misc/cursorbox.js';
|
|
|
|
|
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',
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
onPrimaryClickRelease: () => App.toggleWindow('notification-center'),
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
connections: [[App, (self, windowName, visible) => {
|
2023-11-21 01:29:46 -05:00
|
|
|
if (windowName === 'notification-center') {
|
2023-10-20 23:11:21 -04:00
|
|
|
self.toggleClassName('toggle-on', visible);
|
2023-11-21 01:29:46 -05:00
|
|
|
}
|
2023-10-20 23:11:21 -04:00
|
|
|
}]],
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
child: Box({
|
|
|
|
className: 'notif-panel',
|
|
|
|
vertical: false,
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
children: [
|
|
|
|
Icon({
|
2023-11-27 15:01:54 -05:00
|
|
|
hpack: 'center',
|
2023-11-21 01:29:46 -05:00
|
|
|
connections: [[Notifications, (self) => {
|
2023-10-20 23:11:21 -04:00
|
|
|
if (Notifications.dnd) {
|
|
|
|
self.icon = 'notification-disabled-symbolic';
|
|
|
|
}
|
2023-11-21 01:29:46 -05:00
|
|
|
else if (Notifications.notifications.length > 0) {
|
|
|
|
self.icon = 'notification-new-symbolic';
|
|
|
|
}
|
2023-10-20 23:11:21 -04:00
|
|
|
else {
|
2023-11-21 01:29:46 -05:00
|
|
|
self.icon = 'notification-symbolic';
|
2023-10-20 23:11:21 -04:00
|
|
|
}
|
|
|
|
}]],
|
|
|
|
}),
|
|
|
|
Label({
|
2023-11-21 01:29:46 -05:00
|
|
|
binds: [['label', Notifications, 'notifications',
|
|
|
|
(n) => String(n.length)]],
|
2023-10-20 23:11:21 -04:00
|
|
|
}),
|
2023-09-11 14:38:24 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
],
|
|
|
|
}),
|
2023-09-05 15:10:25 -04:00
|
|
|
});
|