const { Box, Label, Icon } = ags.Widget; const { openWindow, closeWindow } = ags.App; const { Notifications } = ags.Service; import { EventBox, Separator } from '../common.js'; var notifButtonState = false; export const NotifButton = EventBox({ className: 'toggle-off', onPrimaryClickRelease: () => { if (notifButtonState) { NotifButton.toggleClassName('toggle-on', false); closeWindow('notification-center'); notifButtonState = false; } else { NotifButton.toggleClassName('toggle-on', true); openWindow('notification-center'); notifButtonState = true; } }, child: Box({ className: 'notif-panel', vertical: false, children: [ Separator(28), Icon({ connections: [ [Notifications, icon => { icon.icon = Notifications.dnd ? 'notifications-disabled-symbolic' : 'preferences-system-notifications-symbolic'; }], ], }), Separator(8), Label({ connections: [ [Notifications, label => { label.label = String(Notifications.notifications.length); }], ], }), ], }), });