diff --git a/src/windows/notificationtoast/NotificationToasts.qml b/src/windows/notificationtoast/NotificationToasts.qml index c62f9bf..f6f88ea 100644 --- a/src/windows/notificationtoast/NotificationToasts.qml +++ b/src/windows/notificationtoast/NotificationToasts.qml @@ -11,86 +11,79 @@ PopupWindow { rect.x: lbar.width * 1.2 window: popups.win } - mask: Region { - id: mask - item: popupcol - intersection: Intersection.Xor - Region { - item: popupcol.children[0] - intersection: Intersection.Xor - } - - Region { - item: popupcol.children[1] - intersection: Intersection.Xor - } - - Region { - item: popupcol.children[2] - intersection: Intersection.Xor - } - - Region { - item: popupcol.children[3] - intersection: Intersection.Xor - } - - Region { - item: popupcol.children[4] - intersection: Intersection.Xor - } - - Region { - item: popupcol.children[5] - intersection: Intersection.Xor - } - } visible: true + + mask: Region { + item: popups + + Region { + intersection: Intersection.Combine + height: popupcol.count * 26 + popupcol.count * popupcol.spacing + (mouseArea.containsMouse * 114) + width: 300 + } + } + color: "transparent" - height: 500 + height: popupcol.count * 26 + 300 width: 300 - ListView { - id: popupcol - anchors.margins: lbar.width * 0.2 + + MouseArea { + id: mouseArea + hoverEnabled: true anchors.fill: parent - model: ListModel { - id: data - Component.onCompleted: () => { - Notifications.d.notification.connect(e => { - data.insert(0, e); - }); - } - } - addDisplaced: Transition { - NumberAnimation { - properties: "x,y" - duration: 100 - } - } - add: Transition { - NumberAnimation { - properties: "y" - from: -50 - duration: 1000 - } - } - remove: Transition { - ParallelAnimation { - NumberAnimation { - property: "opacity" - to: 0 - duration: 300 + + ListView { + id: popupcol + anchors.margins: lbar.width * 0.2 + anchors.fill: parent + model: ListModel { + id: data + Component.onCompleted: () => { + console.log(popupcol.count); + Notifications.d.notification.connect(e => { + data.insert(0, e); + }); } + } + addDisplaced: Transition { + NumberAnimation { + properties: "x,y" + duration: 100 + } + } + add: Transition { NumberAnimation { properties: "y" - to: -100 - duration: 300 + from: -50 + duration: 1000 + } + } + remove: Transition { + PropertyAction { + property: "ListView.delayRemove" + value: true + } + ParallelAnimation { + NumberAnimation { + property: "opacity" + to: 0 + duration: 300 + } + NumberAnimation { + properties: "y" + to: -100 + duration: 300 + } + } + PropertyAction { + property: "ListView.delayRemove" + value: true } } - } - spacing: 10 - delegate: Toast {} + spacing: 10 + delegate: Toast {} + } } } diff --git a/src/windows/notificationtoast/Toast.qml b/src/windows/notificationtoast/Toast.qml index 5b967ec..e4f76ae 100644 --- a/src/windows/notificationtoast/Toast.qml +++ b/src/windows/notificationtoast/Toast.qml @@ -25,7 +25,7 @@ MouseArea { hoverEnabled: true height: 26 - width: 200 + width: parent.width BRectangle { id: box @@ -35,23 +35,29 @@ MouseArea { anchors.fill: parent anchors.margins: 5 - Row { - Layout.fillWidth: true + RowLayout { + width: parent.width IconImage { - source: Quickshell.iconPath(toast.appIcon) - height: 16 + source: toast.appIcon ? Quickshell.iconPath(toast.appIcon) : "" + height: parent.height + width: height visible: toast.appIcon } Text { text: (toast.appIcon ? " " : toast.appName + ": ") + toast.summary + Layout.fillWidth: true } - Button { - onClicked: toast.close() - width: 16 - height: 16 + Item { + Layout.fillHeight: true + Layout.rightMargin: 16 + Button { + onClicked: toast.close() + height: 16 + width: 16 + } } } @@ -69,7 +75,6 @@ MouseArea { when: toast.containsMouse PropertyChanges { target: toast - width: 250 height: 140 } }