Files
monoshell/Panes/Notifications.qml

41 lines
946 B
QML

import Quickshell
import QtQuick
import Quickshell.Services.Notifications
import "../Widgets" as Widgets
Item {
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
width: 350
height: childrenRect.height + 12
Connections {
target: notifServer
function onNotification(notif) {
if (root.up) return
background.index = 4
notifPopup.modelData = notif
root.open()
timeout.restart()
}
}
Widgets.Notification {
id: notifPopup
y: 6
anchors.margins: 6
modelData: notifServer.trackedNotifications.values[0] ?? undefined
color: "transparent"
}
Timer {
id: timeout
running: false
interval: 3000
onTriggered: root.close()
}
Connections {
target: background
function onIndexChanged() { timeout.stop() }
}
}