From 65143468c540999445300bf9b94bfeb53ce912be Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Wed, 12 Mar 2025 15:37:37 -0300 Subject: [PATCH] :sparkles: ags(notifications): view notification on click if available --- ags/widget/Notification.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ags/widget/Notification.ts b/ags/widget/Notification.ts index 770f1ed..80dbe5a 100644 --- a/ags/widget/Notification.ts +++ b/ags/widget/Notification.ts @@ -23,7 +23,7 @@ export function NotificationWidget(notification: AstalNotifd.Notification|number return new Widget.EventBox({ onClick: () => { - if(notification.actions.length >= 1) { + if(notification.actions.length >= 1 && notification.actions[0].label.toLowerCase() === "view") { notification.invoke(notification.actions[0]!.id); onClose && onClose(notification); } @@ -112,10 +112,13 @@ export function NotificationWidget(notification: AstalNotifd.Notification|number new Widget.Box({ className: "actions button-row", hexpand: true, - visible: notification.actions.length > 1, - children: notification.actions.map((action: AstalNotifd.Action) => + visible: (notification.actions.length === 1 && + notification.actions[0].label.toLowerCase() === "view") + || notification.actions.length === 0 ? false : true, + children: notification.actions.map((action: AstalNotifd.Action, i: number) => new Widget.Button({ className: "action", + visible: i === 0 ? (action.label.toLowerCase() !== "view") : true, label: action.label, hexpand: true, onClicked: () => {