add dismiss timer

This commit is contained in:
lucy 2026-01-17 23:19:54 +01:00
parent e3be2fe22d
commit 1cd52d9a52
2 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,3 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
pragma Singleton pragma Singleton
import Quickshell.Services.Notifications import Quickshell.Services.Notifications

View File

@ -27,7 +27,9 @@ Variants {
left: 10 left: 10
} }
mask: Region { item: notifList } mask: Region {
item: notifList
}
implicitHeight: notifList.contentHeight + 20 implicitHeight: notifList.contentHeight + 20
implicitWidth: modelData.width / 8 implicitWidth: modelData.width / 8
@ -46,12 +48,18 @@ Variants {
model: NotiServer.trackedNotifications model: NotiServer.trackedNotifications
delegate: Item { delegate: Item {
anchors.right: parent ? parent.right : root.right
id: notifyItem id: notifyItem
required property var index required property var index
required property var modelData
anchors.right: parent ? parent.right : root.anchors.right
implicitWidth: root.modelData.width / 8 implicitWidth: root.modelData.width / 8
implicitHeight: notiIcon.implicitHeight + 20 implicitHeight: notiIcon.implicitHeight + 20
required property var modelData Timer {
id: dismissTimer
interval: 5000
running: true
onTriggered: parent.modelData.dismiss()
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@ -93,6 +101,7 @@ Variants {
font.bold: true font.bold: true
elide: Text.ElideRight elide: Text.ElideRight
Layout.fillWidth: true Layout.fillWidth: true
onTextChanged: dismissTimer.restart()
} }
Text { Text {