Initial Notification Daemon Impl

This commit is contained in:
Amaro Lopes
2025-09-22 23:49:22 -03:00
parent 99f7e41ff4
commit 01afd5718c
4 changed files with 79 additions and 8 deletions

40
NotificationsWidget.qml Normal file
View File

@@ -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)
}
}
}
}

View File

@@ -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
}

View File

@@ -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(

View File

@@ -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"]
}