Notifications
signals
dismissed:(id: number)notification removed from popupsnotified:(id: number)notification added to popups and notificationsclosed:(id: number)notification removed from popups and notifications
properties
popupTimeout:number: milliseconds, 3000 by defaultforceTimeout:boolean: Force every notifications timeout to bepopupTimeout. false by default.cacheActions:boolean: Action buttons don’t work if the sender process is no longer running. So on reboot they won’t work. false by defaultclearDelay:number: milliseconds to wait after each notification closed when callingclear. This is to prevent crashes when its not handled by the user.dnd:boolean: do no disturb, it will permit the notification to be added to Notifications.popupspopups:Notification[]notifications:Notification[]
methods
clear:() => void: removes all notificationsgetNotification:(id: number) => NotificationgetPopup:(id: number) => Notification
Notification
signals
dismissednotification.popup became falseclosedinvoked:(action: string)
properties
id:numberapp-name:stringapp-entry:string | null.desktop fileapp-icon:stringsummary:stringtitlebody:stringactions:Array<{ id: string, label: string }>urgency:"low" | "normal" | "critical"time:numberyou canGLib.DateTime.new_from_unix_local(time)image:string | nullpath to the imagepopup:booleanwhether this should show as a popup bannerhints:Record<string, GLib.Variant>notification hints, these are not cached and this returns an empty object if loaded from cache
methods
dismiss() => voidsets popup to falseclose() => voidinvoke(actionId: string) => voidinvoking an action will also close the notification
Example
const notifications = await Service.import("notifications")notifications.popupTimeout = 3000;notifications.forceTimeout = false;notifications.cacheActions = false;notifications.clearDelay = 100;
Widget.Label({ label: notifications.bind("notifications").as(n => `there are ${n.length} notifications` )})Example Notification Popups
