feat: add notification sound and notification window enhancements. Ready for alpha.NotificationBody needs work

This commit is contained in:
Hannes
2026-08-26 00:38:20 +02:00
parent 0b20e8eb85
commit 3cd6807681
7 changed files with 193 additions and 88 deletions
+46 -15
View File
@@ -5,18 +5,24 @@ import "../../config"
import "./notificationServer"
PanelWindow {
mask: Region {}
// mask: Region {}
id: notificationWindow
anchors.top: true
anchors.left: true
implicitHeight: screen.height/6
implicitWidth: screen.width/6
// implicitHeight: screen.height/6
implicitHeight: contentHeight+(content.spacing*(notificationListModel.count-1))
implicitWidth: contentWidth
color: "transparent"
ListModel {
id: notificationListModel
}
Connections {
target: NotificationS
@@ -25,17 +31,11 @@ PanelWindow {
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])
notificationListModel.append({notificationData: notification})
}
}
}
property var currentNotification: null
property var currentNotifications: []
Rectangle {
anchors.fill: parent
@@ -44,22 +44,53 @@ PanelWindow {
color: "transparent"
Column {
id: content
anchors.fill: parent
anchors.margins: 10
spacing: 5
spacing: -2
Repeater {
model: currentNotifications
id: notificationRepeater
model: notificationListModel
delegate: NotificationBody {
required property int index
required property var notificationData
notification: currentNotifications[index]
width: notificationWindow.width
notification: notificationData
onDismissed: function(notification) {
notificationListModel.remove(index)
notification.dismiss()
console.log("[Notification]: Dismissed Notification:", notification.appName, notification.id, notification.summary, notification.body)
}
}
onItemAdded: updateContentSize()
onItemRemoved: updateContentSize()
}
}
}
property real contentWidth: 0
property real contentHeight: 0
function updateContentSize() {
let width = 0
let height = 0
for (let i = 0; i < notificationRepeater.count; ++i) {
let item = notificationRepeater.itemAt(i)
if (item) {
width = Math.max(width, item.width)
height += item.height
}
}
contentWidth = width
contentHeight = height
console.log("[updateContentSize] contentWidth:", contentWidth, "contentHeight:", contentHeight)
}
Component.onCompleted: {
console.log(
"[Notification]:",