This commit is contained in:
2026-02-09 00:09:29 -08:00
parent add0b3d66f
commit 925b01939c
7 changed files with 270 additions and 125 deletions

96
NotifPopup.qml Normal file
View File

@@ -0,0 +1,96 @@
import Quickshell
import Quickshell.Services.Notifications
import QtQuick
import QtQuick.Effects
import "./NotificationBox.qml"
PanelWindow {
id: root
visible: false
anchors {
top: true
right: true
}
color: "transparent"
aboveWindows: true
implicitWidth: 500
implicitHeight: 200
focusable: false
property var font: { family: "Comfortaa" }
Component {
id: notifPopup
NotificationBox {
id: notifBox
y: {
let res = 0;
for (let i = 0; notifsList.children[i] && notifsList.children[i] != this; i++) {
if (!notifsList.children[i].exiting) res += notifsList.children[i].height + 10;
}
return res;
}
Behavior on y { NumberAnimation {
duration: 300
easing.type: Easing.InOutCubic
}}
RectangularShadow {
z: -1
anchors.fill: parent
blur: 12
radius: parent.radius
}
NumberAnimation on x {
running: root.visible
from: root.width
to: 0
duration: 300
easing.type: Easing.OutBack
easing.overshoot: 0.8
}
NumberAnimation on x {
id: exitAnim
running: false
to: parent.parent.width
duration: 300
easing.type: Easing.InCubic
onStarted: exiting = true
onFinished: {
if (notifsList.children.length === 1) {
root.visible = false
root.implicitHeight = 200;
}
notifBox.destroy();
}
}
Timer {
running: true
repeat: false
interval: 5000
onTriggered: exitAnim.start()
}
Component.onCompleted: {
let sumHeight = 40;
for (const notif of notifsList.children) {
sumHeight += notif.height + 6;
}
root.implicitHeight = Math.max(root.implicitHeight, sumHeight);
}
}
}
Item {
id: notifsList
anchors {
fill: parent
margins: 12
leftMargin: 64
}
}
function notify(notif) {
if (notif.lastGeneration) return
root.visible = true;
notifPopup.createObject(notifsList, {notification: notif});
}
}