From 63e81369c299c5641f7743a31028e3fb3f2eebc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Zanghelini?= Date: Thu, 9 Oct 2025 23:08:25 -0300 Subject: [PATCH 1/5] Show notification indicator on "tray" --- .../quickshell/ii/modules/bar/BarContent.qml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.config/quickshell/ii/modules/bar/BarContent.qml b/.config/quickshell/ii/modules/bar/BarContent.qml index 4f538e1cc..818800021 100644 --- a/.config/quickshell/ii/modules/bar/BarContent.qml +++ b/.config/quickshell/ii/modules/bar/BarContent.qml @@ -295,6 +295,40 @@ Item { // Bar content region Layout.rightMargin: indicatorsRowLayout.realSpacing color: rightSidebarButton.colText } + Revealer { + reveal: Notifications.silent || Notifications.list.length > 0 + Layout.fillHeight: true + Layout.rightMargin: reveal ? indicatorsRowLayout.realSpacing : 0 + implicitHeight: reveal ? notificationIcon.implicitHeight : 0 + implicitWidth: reveal ? notificationIcon.implicitWidth : 0 + Behavior on Layout.rightMargin { + animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) + } + Rectangle { + visible: !Notifications.silent + anchors.right: parent.right + radius: Appearance.rounding.full + color: Appearance.colors.colLayer0 + z: 1 + + implicitHeight: Math.max(notificationCounterText.implicitWidth, notificationCounterText.implicitHeight) + implicitWidth: Math.max(notificationCounterText.implicitWidth, notificationCounterText.implicitHeight) + + StyledText { + id: notificationCounterText + anchors.centerIn: parent + font.pixelSize: Appearance.font.pixelSize.smallest + color: Appearance.colors.colOnLayer1 + text: Notifications.list.length + } + } + MaterialSymbol { + id: notificationIcon + text: Notifications.silent ? "notifications_paused" : "notifications" + iconSize: Appearance.font.pixelSize.larger + color: rightSidebarButton.colText + } + } MaterialSymbol { Layout.rightMargin: indicatorsRowLayout.realSpacing text: Network.materialSymbol From 7e46145df1667178aaeebaf1a11cc29942674307 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 12 Oct 2025 09:59:29 +0200 Subject: [PATCH 2/5] fix opening right sidebar with mouse not dismissing notifs --- .config/quickshell/ii/GlobalStates.qml | 7 ++++++- .../quickshell/ii/modules/sidebarRight/SidebarRight.qml | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.config/quickshell/ii/GlobalStates.qml b/.config/quickshell/ii/GlobalStates.qml index 077a810bc..098b957ea 100644 --- a/.config/quickshell/ii/GlobalStates.qml +++ b/.config/quickshell/ii/GlobalStates.qml @@ -1,5 +1,6 @@ -import qs.modules.common import qs +import qs.modules.common +import qs.services import QtQuick import Quickshell import Quickshell.Hyprland @@ -44,6 +45,10 @@ Singleton { } } + onSidebarRightOpenChanged: { + if(GlobalStates.sidebarRightOpen) Notifications.timeoutAll(); + } + property real screenZoom: 1 onScreenZoomChanged: { Quickshell.execDetached(["hyprctl", "keyword", "cursor:zoom_factor", root.screenZoom.toString()]); diff --git a/.config/quickshell/ii/modules/sidebarRight/SidebarRight.qml b/.config/quickshell/ii/modules/sidebarRight/SidebarRight.qml index cdc861ce6..fcba76710 100644 --- a/.config/quickshell/ii/modules/sidebarRight/SidebarRight.qml +++ b/.config/quickshell/ii/modules/sidebarRight/SidebarRight.qml @@ -70,7 +70,6 @@ Scope { function toggle(): void { GlobalStates.sidebarRightOpen = !GlobalStates.sidebarRightOpen; - if(GlobalStates.sidebarRightOpen) Notifications.timeoutAll(); } function close(): void { @@ -79,7 +78,6 @@ Scope { function open(): void { GlobalStates.sidebarRightOpen = true; - Notifications.timeoutAll(); } } @@ -89,7 +87,6 @@ Scope { onPressed: { GlobalStates.sidebarRightOpen = !GlobalStates.sidebarRightOpen; - if(GlobalStates.sidebarRightOpen) Notifications.timeoutAll(); } } GlobalShortcut { @@ -98,7 +95,6 @@ Scope { onPressed: { GlobalStates.sidebarRightOpen = true; - Notifications.timeoutAll(); } } GlobalShortcut { 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 3/5] 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); From 3b689f8a66385486567c0eefae4364ab1991a18a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 12 Oct 2025 10:06:23 +0200 Subject: [PATCH 4/5] notif indicator: fix readability --- .config/quickshell/ii/modules/bar/BarContent.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/BarContent.qml b/.config/quickshell/ii/modules/bar/BarContent.qml index 934dd26da..978ef10b0 100644 --- a/.config/quickshell/ii/modules/bar/BarContent.qml +++ b/.config/quickshell/ii/modules/bar/BarContent.qml @@ -305,10 +305,10 @@ Item { // Bar content region animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) } Rectangle { - visible: !Notifications.silent + visible: !Notifications.silent && Notifications.unread > 0 anchors.right: parent.right radius: Appearance.rounding.full - color: Appearance.colors.colLayer0 + color: Appearance.colors.colOnLayer0 z: 1 implicitHeight: Math.max(notificationCounterText.implicitWidth, notificationCounterText.implicitHeight) @@ -318,7 +318,7 @@ Item { // Bar content region id: notificationCounterText anchors.centerIn: parent font.pixelSize: Appearance.font.pixelSize.smallest - color: Appearance.colors.colOnLayer1 + color: Appearance.colors.colLayer0 text: Notifications.unread } } From 3ffc25d5d8d0e315fbf89af1b0a10efbb51fbaed Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 12 Oct 2025 10:23:34 +0200 Subject: [PATCH 5/5] add option to show/hide unread notif count --- .config/quickshell/ii/modules/bar/BarContent.qml | 14 +++++++++++--- .config/quickshell/ii/modules/common/Config.qml | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/BarContent.qml b/.config/quickshell/ii/modules/bar/BarContent.qml index 978ef10b0..0ab135a50 100644 --- a/.config/quickshell/ii/modules/bar/BarContent.qml +++ b/.config/quickshell/ii/modules/bar/BarContent.qml @@ -305,17 +305,25 @@ Item { // Bar content region animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) } Rectangle { + id: notifPing visible: !Notifications.silent && Notifications.unread > 0 - anchors.right: parent.right + property bool showUnreadCount: Config.options.bar.indicators.notifications.showUnreadCount + anchors { + right: parent.right + top: parent.top + rightMargin: showUnreadCount ? 0 : 1 + topMargin: showUnreadCount ? 0 : 3 + } radius: Appearance.rounding.full color: Appearance.colors.colOnLayer0 z: 1 - implicitHeight: Math.max(notificationCounterText.implicitWidth, notificationCounterText.implicitHeight) - implicitWidth: Math.max(notificationCounterText.implicitWidth, notificationCounterText.implicitHeight) + implicitHeight: showUnreadCount ? Math.max(notificationCounterText.implicitWidth, notificationCounterText.implicitHeight) : 8 + implicitWidth: implicitHeight StyledText { id: notificationCounterText + visible: notifPing.showUnreadCount anchors.centerIn: parent font.pixelSize: Appearance.font.pixelSize.smallest color: Appearance.colors.colLayer0 diff --git a/.config/quickshell/ii/modules/common/Config.qml b/.config/quickshell/ii/modules/common/Config.qml index ea99949d5..0e28b9e87 100644 --- a/.config/quickshell/ii/modules/common/Config.qml +++ b/.config/quickshell/ii/modules/common/Config.qml @@ -198,6 +198,11 @@ Singleton { property bool useUSCS: false // Instead of metric (SI) units property int fetchInterval: 10 // minutes } + property JsonObject indicators: JsonObject { + property JsonObject notifications: JsonObject { + property bool showUnreadCount: false + } + } } property JsonObject battery: JsonObject {