repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
pi/agent/skills/optional/quickshell/examples/08-notification-daemon/shell.qml
Raw// Minimal plain-text notification example, not a production daemon.
// Run only with an isolated session bus and nested compositor.
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Services.Notifications
Scope {
NotificationServer {
id: server
actionsSupported: false
bodyMarkupSupported: false
persistenceSupported: false
bodyHyperlinksSupported: false
bodyImagesSupported: false
inlineReplySupported: false
onNotification: notification => notification.tracked = true
}
// Variants can instantiate windows; Repeater delegates must be Items.
Variants {
model: server.trackedNotifications
delegate: Component {
PanelWindow {
id: popup
required property var modelData
anchors {
bottom: true
right: true
}
margins {
bottom: 30 + server.trackedNotifications.values.indexOf(popup.modelData) * 88
right: 16
}
exclusiveZone: 0
implicitWidth: 360
implicitHeight: 80
color: "transparent"
mask: Region {}
// Quickshell uses seconds: zero persists, negative requests daemon policy.
Timer {
interval: popup.modelData.expireTimeout > 0 ? popup.modelData.expireTimeout * 1000 : 5000
running: popup.modelData.expireTimeout !== 0
repeat: false
onTriggered: popup.modelData.expire()
}
Rectangle {
anchors.fill: parent
radius: 8
color: "#dd1e1e2e"
border.color: "#444"
border.width: 1
Column {
anchors.fill: parent
anchors.margins: 12
spacing: 4
Text {
text: popup.modelData.summary
textFormat: Text.PlainText
color: "white"
font.pointSize: 12
font.bold: true
elide: Text.ElideRight
width: parent.width
}
Text {
text: popup.modelData.body
textFormat: Text.PlainText
color: "#ccc"
font.pointSize: 10
elide: Text.ElideRight
width: parent.width
visible: text.length > 0
}
}
}
}
}
}
}