From 2b62a5a0cc538080d8e1133c5903b35745985e6a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 12 Oct 2025 10:03:12 +0200 Subject: [PATCH] make notif indicator only show unread --- .config/quickshell/ii/GlobalStates.qml | 5 ++++- .config/quickshell/ii/modules/bar/BarContent.qml | 4 ++-- .config/quickshell/ii/services/Notifications.qml | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.config/quickshell/ii/GlobalStates.qml b/.config/quickshell/ii/GlobalStates.qml index 098b957ea..caf94ab16 100644 --- a/.config/quickshell/ii/GlobalStates.qml +++ b/.config/quickshell/ii/GlobalStates.qml @@ -46,7 +46,10 @@ Singleton { } onSidebarRightOpenChanged: { - if(GlobalStates.sidebarRightOpen) Notifications.timeoutAll(); + if (GlobalStates.sidebarRightOpen) { + Notifications.timeoutAll(); + Notifications.markAllRead(); + } } property real screenZoom: 1 diff --git a/.config/quickshell/ii/modules/bar/BarContent.qml b/.config/quickshell/ii/modules/bar/BarContent.qml index 818800021..934dd26da 100644 --- a/.config/quickshell/ii/modules/bar/BarContent.qml +++ b/.config/quickshell/ii/modules/bar/BarContent.qml @@ -296,7 +296,7 @@ Item { // Bar content region color: rightSidebarButton.colText } Revealer { - reveal: Notifications.silent || Notifications.list.length > 0 + reveal: Notifications.silent || Notifications.unread > 0 Layout.fillHeight: true Layout.rightMargin: reveal ? indicatorsRowLayout.realSpacing : 0 implicitHeight: reveal ? notificationIcon.implicitHeight : 0 @@ -319,7 +319,7 @@ Item { // Bar content region anchors.centerIn: parent font.pixelSize: Appearance.font.pixelSize.smallest color: Appearance.colors.colOnLayer1 - text: Notifications.list.length + text: Notifications.unread } } MaterialSymbol { diff --git a/.config/quickshell/ii/services/Notifications.qml b/.config/quickshell/ii/services/Notifications.qml index 00a87c3a7..16d8b760f 100644 --- a/.config/quickshell/ii/services/Notifications.qml +++ b/.config/quickshell/ii/services/Notifications.qml @@ -69,6 +69,7 @@ Singleton { } property bool silent: false + property int unread: 0 property var filePath: Directories.notificationsPath property list list: [] property var popupList: list.filter((notif) => notif.popup); @@ -173,12 +174,17 @@ Singleton { } } + root.unread++; root.notify(newNotifObject); // console.log(notifToString(newNotifObject)); notifFileView.setText(stringifyList(root.list)); } } + function markAllRead() { + root.unread = 0; + } + function discardNotification(id) { console.log("[Notifications] Discarding notification with ID: " + id); const index = root.list.findIndex((notif) => notif.notificationId === id);