From 33677150b101d63e1792496f3c315fa225960018 Mon Sep 17 00:00:00 2001 From: euletheia <154215350+euletheia@users.noreply.github.com> Date: Mon, 27 Jul 2026 15:13:07 +0000 Subject: [PATCH] feat(ipc): add 'dismiss' function to notifications ipc (#2942) Allow to dismiss the last visible notification only instead of resorting directly to dismissAllPopups. --- quickshell/Modals/NotificationModal.qml | 9 +++++++++ quickshell/Services/NotificationService.qml | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/quickshell/Modals/NotificationModal.qml b/quickshell/Modals/NotificationModal.qml index 518782302..b6c4e8787 100644 --- a/quickshell/Modals/NotificationModal.qml +++ b/quickshell/Modals/NotificationModal.qml @@ -64,6 +64,10 @@ DankModal { NotificationService.dismissAllPopups(); } + function dismissLastNotification() { + NotificationService.dismissLastNotification(); + } + modalWidth: Math.min(500, screenWidth - 48) modalHeight: Math.min(700, screenHeight * 0.85) backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency) @@ -190,6 +194,11 @@ DankModal { return "NOTIFICATION_MODAL_DISMISS_ALL_POPUPS_SUCCESS"; } + function dismiss(): string { + notificationModal.dismissLastNotification(); + return "NOTIFICATION_DISMISS_SUCCESS"; + } + target: "notifications" } diff --git a/quickshell/Services/NotificationService.qml b/quickshell/Services/NotificationService.qml index 613f1d9fd..7674a875d 100644 --- a/quickshell/Services/NotificationService.qml +++ b/quickshell/Services/NotificationService.qml @@ -889,6 +889,12 @@ Singleton { NotifWrapper {} } + function dismissLastNotification() { + const w = visibleNotifications[visibleNotifications.length - 1]; + if (w) + dismissNotification(w); + } + function dismissAllPopups() { for (const w of visibleNotifications) { if (w) {