diff --git a/NotificationsWidget.qml b/NotificationsWidget.qml new file mode 100644 index 0000000..083ea0d --- /dev/null +++ b/NotificationsWidget.qml @@ -0,0 +1,40 @@ +import QtQuick +import Quickshell.Widgets +import qs.Services +import qs.Common +import Quickshell.Services.Notifications + +Item { + property var monitor: "" + + MarginWrapperManager { + rightMargin: Theme.gaps + leftMargin: Theme.gaps + } + + Rectangle { + color: Theme.backgroudColor + implicitWidth: clockText.implicitWidth * 1.6 + implicitHeight: Theme.heightGaps //root.implicitHeight*0.8 + radius: 25 + + Text { + id: clockText + + anchors.centerIn: parent + text: "OPA!" + font.bold: true + font.pixelSize: 14 + font.family: Theme.fontFamily + color: Theme.textColor + } + MouseArea{ + anchors.fill: parent + onClicked: { + console.log(Notifications.tracked) + } + } + + } + +} diff --git a/Services/Notifications.qml b/Services/Notifications.qml new file mode 100644 index 0000000..15cd122 --- /dev/null +++ b/Services/Notifications.qml @@ -0,0 +1,28 @@ +pragma Singleton + +import QtQuick +import Quickshell +import Quickshell.Services.Notifications + +Singleton { + id: notificationsRoot + + NotificationServer { + id: nServer + imageSupported: true + + } + + Connections { + function onNotification(rapazinho) { + console.log(rapazinho.id) + console.log(nServer.trackedNotifications) + } + + target: nServer + } + + property var tracked: nServer.trackedNotifications + + +} diff --git a/SysTrayWidget.qml b/SysTrayWidget.qml index ea13dba..66577da 100644 --- a/SysTrayWidget.qml +++ b/SysTrayWidget.qml @@ -1,4 +1,6 @@ +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Layouts import Quickshell @@ -8,7 +10,7 @@ import qs.Common WrapperRectangle { id: systrayRoot - property var monitor: "" + property string monitor: "" rightMargin: Theme.gaps leftMargin: Theme.gaps radius: 25 @@ -17,13 +19,16 @@ WrapperRectangle { // color: Theme.backgroudColor RowLayout { - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + property var monitor: parent.monitor + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Repeater { + property string monitor: parent.monitor model: SystemTray.items.values delegate: Rectangle { id: systrayItem required property var modelData + property string monitor: parent.monitor property var model: modelData property string iconSource: { let icon = systrayItem.model && systrayItem.model.icon; @@ -52,7 +57,7 @@ WrapperRectangle { anchors.verticalCenter:parent.verticalCenter anchors.horizontalCenter:parent.horizontalCenter width:25; height:25 - source: iconSource + source: systrayItem.iconSource } @@ -64,10 +69,8 @@ WrapperRectangle { const globalPos = mapToGlobal(0, 0); - const currentScreen = systrayRoot.monitor - const screenX = currentScreen.x || 0; - console.log(screenX) - const relativeX = globalPos.x - screenX; + const currentScreen = parent.monitor + const relativeX = globalPos.x; menuAnchor.menu = systrayItem.model.menu; menuAnchor.anchor.window = root; menuAnchor.anchor.rect = Qt.rect( diff --git a/shell.qml b/shell.qml index 1ab8f40..727678a 100644 --- a/shell.qml +++ b/shell.qml @@ -4,7 +4,7 @@ import Quickshell ShellRoot { Bar { panelMonitor: "DP-1" - barComponentsLeft: [] + barComponentsLeft: ["NotificationsWidget.qml"] barComponentsCenter: ["Workspaces.qml"] barComponentsRight: ["AudioWidget.qml", "SysTrayWidget.qml", "ClockWidget.qml"] }