diff --git a/Bar.qml b/Bar.qml index c703ff9..fcc756a 100644 --- a/Bar.qml +++ b/Bar.qml @@ -4,6 +4,7 @@ import Quickshell import Quickshell.Io import qs.Modules import qs.Config +import qs.Helpers Scope { Variants { @@ -16,10 +17,6 @@ Scope { screen: modelData property var root: Quickshell.shellDir - Component.onCompleted: { - console.log(modelData.x); - } - Process { id: ncProcess command: ["sh", "-c", `qs -p ${bar.root}/shell.qml ipc call root showCenter`] @@ -102,10 +99,11 @@ Scope { } Text { + id: notificationCenterIcon Layout.alignment: Qt.AlignVCenter - text: "\ue7f4" + text: HasNotifications.hasNotifications ? "\uf4fe" : "\ue7f4" font.family: "Material Symbols Rounded" - font.pixelSize: 20 + font.pixelSize: 22 color: "white" MouseArea { anchors.fill: parent diff --git a/Helpers/HasNotifications.qml b/Helpers/HasNotifications.qml new file mode 100644 index 0000000..5479858 --- /dev/null +++ b/Helpers/HasNotifications.qml @@ -0,0 +1,15 @@ +pragma Singleton + +import Quickshell +import Quickshell.Io + +Singleton { + id: root + + property alias hasNotifications: adapter.hasNotifications + + JsonObject { + id: adapter + property bool hasNotifications: false + } +} diff --git a/Modules/NotificationCenter.qml b/Modules/NotificationCenter.qml index 9fa73ad..50875c2 100644 --- a/Modules/NotificationCenter.qml +++ b/Modules/NotificationCenter.qml @@ -8,6 +8,7 @@ import QtQuick.Effects import QtQuick import Quickshell.Services.Notifications import qs.Config +import qs.Helpers PanelWindow { id: root @@ -26,6 +27,14 @@ PanelWindow { mask: Region { item: backgroundRect } + onNotificationsChanged: { + if ( root.notifications.length > 0 ) { + HasNotifications.hasNotifications = true; + } else { + HasNotifications.hasNotifications = false; + } + } + IpcHandler { id: ipcHandler target: "root" diff --git a/Modules/TrayItem.qml b/Modules/TrayItem.qml index 4fa3308..f7965b0 100644 --- a/Modules/TrayItem.qml +++ b/Modules/TrayItem.qml @@ -14,7 +14,7 @@ MouseArea { property point globalPos implicitWidth: 22 - implicitHeight: 22 + implicitHeight: parent.height hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton diff --git a/Modules/TrayWidget.qml b/Modules/TrayWidget.qml index 030d985..7a69af7 100644 --- a/Modules/TrayWidget.qml +++ b/Modules/TrayWidget.qml @@ -9,11 +9,11 @@ Rectangle { id: root required property PanelWindow bar implicitHeight: parent.height - implicitWidth: rowL.implicitWidth + 20 + implicitWidth: rowL.implicitWidth + 10 color: "transparent" RowLayout { - spacing: 10 + spacing: 5 id: rowL anchors.centerIn: parent Repeater {