From e2a0c19267418d162781a559422e600ac30b71f3 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Wed, 26 Feb 2025 18:01:07 +1100
Subject: notifpopups: activate action if only one

---
 src/modules/notifpopups.tsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/modules/notifpopups.tsx')

diff --git a/src/modules/notifpopups.tsx b/src/modules/notifpopups.tsx
index c3f687a..0332fa7 100644
--- a/src/modules/notifpopups.tsx
+++ b/src/modules/notifpopups.tsx
@@ -31,8 +31,12 @@ export default () => (
                     self.add(
                         <eventbox
                             onClick={(_, event) => {
-                                // Go to notif center on primary click
-                                if (event.button === Astal.MouseButton.PRIMARY) App.get_window("notifications")?.show();
+                                // Activate notif or go to notif center on primary click
+                                if (event.button === Astal.MouseButton.PRIMARY) {
+                                    if (notification.actions.length === 1)
+                                        notification.invoke(notification.actions[0].id);
+                                    else App.get_window("notifications")?.show();
+                                }
                                 // Dismiss on middle click
                                 else if (event.button === Astal.MouseButton.MIDDLE) notification.dismiss();
                             }}
-- 
cgit v1.2.3-freya

