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 implicitHeight: contentHeight+(content.spacing*(notificationListModel.count-1)) implicitWidth: contentWidth color: "transparent" ListModel { id: notificationListModel } 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) notificationListModel.append({notificationData: notification}) } } } Rectangle { anchors.fill: parent border.width: Config.border_width border.color: Colors.primary color: "transparent" Column { id: content anchors.fill: parent spacing: -2 Repeater { id: notificationRepeater model: notificationListModel delegate: NotificationBody { required property int index required property var notificationData 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]:", NotificationS, "notification:", NotificationS.newestNotification ) } }