import { Astal, Gtk } from "ags/gtk4"; import { createBinding, createComputed, For } from "ags"; import { Notifications } from "../../modules/notifications"; import { NotificationWidget } from "../../widget/Notification"; import { generalConfig } from "../../config"; import AstalNotifd from "gi://AstalNotifd"; import Adw from "gi://Adw?version=1"; const size = 450; export const FloatingNotifications = (mon: number) => { const pos: Array = []; switch(posH) { case "left": pos.push(Astal.WindowAnchor.LEFT); break; case "center": pos.push(Astal.WindowAnchor.LEFT); pos.push(Astal.WindowAnchor.RIGHT); break; case "right": pos.push(Astal.WindowAnchor.RIGHT); break; } switch(posV) { case "top": pos.push(Astal.WindowAnchor.TOP); break; case "center": pos.push(Astal.WindowAnchor.TOP); pos.push(Astal.WindowAnchor.BOTTOM); break; case "bottom": pos.push(Astal.WindowAnchor.BOTTOM); break; } let finalPos: Astal.WindowAnchor; pos.forEach(pos => finalPos = (finalPos !== undefined ? finalPos | pos : pos)); return finalPos!; })} exclusivity={Astal.Exclusivity.NORMAL} resizable={false} widthRequest={450}> {(notif: AstalNotifd.Notification) => { //TODO: support different animations depending on screen position return Gtk.StackTransitionType.SLIDE_RIGHT })} transitionDuration={300}> Notifications.getDefault().removeNotification(notif)} holdOnHover actionClicked={() => { const viewAction = notif.actions.filter(a => a.id.toLowerCase() === "view" || a.label.toLowerCase() === "view" )?.[0]; viewAction && notif.invoke(viewAction.id); }} /> as Gtk.Widget }> } as Astal.Window;