diff --git a/quickshell/Modals/NotificationModal.qml b/quickshell/Modals/NotificationModal.qml index 128d8d5c..500c641b 100644 --- a/quickshell/Modals/NotificationModal.qml +++ b/quickshell/Modals/NotificationModal.qml @@ -57,6 +57,10 @@ DankModal { } } + function clearAll() { + NotificationService.clearAllNotifications(); + } + modalWidth: 500 modalHeight: 700 backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency) @@ -104,6 +108,11 @@ DankModal { return "NOTIFICATION_MODAL_TOGGLE_DND_SUCCESS"; } + function clearAll(): string { + notificationModal.clearAll(); + return "NOTIFICATION_MODAL_CLEAR_ALL_SUCCESS"; + } + target: "notifications" } diff --git a/quickshell/Services/NotificationService.qml b/quickshell/Services/NotificationService.qml index b6e82b2c..87b6d946 100644 --- a/quickshell/Services/NotificationService.qml +++ b/quickshell/Services/NotificationService.qml @@ -414,6 +414,9 @@ Singleton { } function clearAllNotifications() { + if (!notifications.length) { + return; + } bulkDismissing = true; popupsDisabled = true; addGate.stop();