import { App, Gtk } from 'astal/gtk3'; import { Variable } from 'astal'; import GLib from 'gi://GLib?version=2.0'; import AstalApps from 'gi://AstalApps?version=0.1'; const Applications = AstalApps.Apps.new(); import AstalNotifd from 'gi://AstalNotifd?version=0.1'; const Notifications = AstalNotifd.get_default(); import NotifGestureWrapper from './gesture'; // Make a variable to connect to for Widgets // to know when there are notifs or not export const HasNotifs = Variable(false); const setTime = (time: number): string => { return GLib.DateTime .new_from_unix_local(time) .format('%H:%M') ?? ''; }; const NotifIcon = ({ notifObj }: { notifObj: AstalNotifd.Notification }) => { let icon: string; if (notifObj.get_image() !== '') { icon = notifObj.get_image(); App.add_icons(icon); } else if (notifObj.get_app_icon() !== '') { icon = notifObj.get_app_icon(); } else { icon = Applications.query( notifObj.get_app_name(), false, )[0].get_icon_name(); } return ( ); }; const BlockedApps = [ 'Spotify', ]; export const Notification = ({ id = 0, }): ReturnType | undefined => { const notifObj = Notifications.get_notification(id); if (!notifObj) { return; } if (BlockedApps.find((app) => app === notifObj.app_name)) { notifObj.dismiss(); return; } HasNotifs.set(Notifications.get_notifications().length > 0); return ( {/* Content */} {/* Top of Content */} {/* Title */} {/* Description */} {/* Actions */} {notifObj.get_actions().map((action) => ( ))} ) as ReturnType; };