import QtQuick import Quickshell import Quickshell.Services.Notifications import "." as M import "../services" as S import "../applets" as C import NovaStats as NS M.BarModule { id: root active: NS.ModulesService.notificationsEnable spacing: NS.ThemeService.moduleSpacing tooltip: S.NotifService.count > 0 ? "Notifications: " + S.NotifService.count + (S.NotifService.dnd ? " (DND)" : "") : (S.NotifService.dnd ? "Do not disturb" : "No notifications") panelNamespace: "nova-notifications" panelContentWidth: 350 panelComponent: Component { C.NotifApplet { width: parent.width contentWidth: root.panelContentWidth accentColor: root.accentColor } } readonly property bool hasUrgent: S.NotifService.list.some(n => n.urgency === NotificationUrgency.Critical && n.state !== "dismissed") M.BarIcon { icon: { if (S.NotifService.dnd) return S.NotifService.count > 0 ? "\uDB80\uDCA0" : "\uDB82\uDE93"; return S.NotifService.count > 0 ? "\uDB84\uDD6B" : "\uDB80\uDC9C"; } color: S.NotifService.dnd ? NS.ThemeService.base04 : root.accentColor anchors.verticalCenter: parent.verticalCenter } M.BarLabel { id: countLabel label: S.NotifService.count > 0 ? String(S.NotifService.count) + (root.hasUrgent ? "!" : "") : "" color: root.hasUrgent ? NS.ThemeService.base08 : root.accentColor anchors.verticalCenter: parent.verticalCenter transform: Scale { id: countScale origin.x: countLabel.width / 2 origin.y: countLabel.height / 2 xScale: 1 yScale: 1 } SequentialAnimation { id: popAnim NumberAnimation { target: countScale properties: "xScale,yScale" to: 1.4 duration: 100 easing.type: Easing.OutQuad } NumberAnimation { target: countScale properties: "xScale,yScale" to: 1.0 duration: 200 easing.type: Easing.OutElastic } } } Connections { target: S.NotifService function onCountChanged() { if (S.NotifService.count > 0 && !S.ThemeUtil.reducedMotion) popAnim.start(); } } // Right-click DND quick toggle TapHandler { acceptedButtons: Qt.RightButton onTapped: S.NotifService.toggleDnd() } }