feat: add notification module with functionality to display notifications on focused monitor with a NotificationServer as Singleton

This commit is contained in:
Hannes
2026-08-25 01:00:52 +02:00
parent b9a455347d
commit 0b20e8eb85
6 changed files with 215 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
import QtQuick
import Quickshell
import Quickshell.Services.Notifications
import "../../config"
import "./notificationServer"
PanelWindow {
mask: Region {}
id: notificationWindow
anchors.top: true
anchors.left: true
implicitHeight: screen.height/6
implicitWidth: screen.width/6
color: "transparent"
Connections {
target: NotificationS
function onNotificationReceived(notification) {
if (!NotificationS.correctMonitor(screen))
return
if (NotificationS.correctMonitor(screen)) {
console.log("[Notification]: This notification belongs to me!", screen.x, screen.y)
// currentNotifications.push(notification)
// currentNotifications = currentNotifications
currentNotification = notification
currentNotifications = currentNotifications.concat([notification])
}
}
}
property var currentNotification: null
property var currentNotifications: []
Rectangle {
anchors.fill: parent
border.width: Config.border_width
border.color: Colors.primary
color: "transparent"
Column {
anchors.fill: parent
anchors.margins: 10
spacing: 5
Repeater {
model: currentNotifications
delegate: NotificationBody {
required property int index
notification: currentNotifications[index]
width: notificationWindow.width
}
}
}
}
Component.onCompleted: {
console.log(
"[Notification]:",
NotificationS,
"notification:",
NotificationS.newestNotification
)
}
}