repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

notifications: invoke the default action by clicking the card body

3e2fc0dc80cde028da724c4f52244411d86fcaaa

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

freedesktop treats an action with id "default" as the one fired by
clicking the notification itself, not a labelled button. Filter "default"
out of the action button Flow and invoke it from the card's body click
(buttons declared later still sit above the body area, so explicit actions
are unaffected). Verified end-to-end: clicking routes to the native action.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Changed files (1)

quickshell/nuguland/NotificationCard.qml

Modified
76 76 visible: String(card.modelData.urgency || "normal") !== "low"
79 + // freedesktop "default" action: invoked by clicking the notification body
80 + // (not rendered as a button). Buttons declared later sit above this area,
81 + // so clicks on them are unaffected.
82 + readonly property var defaultAction: (modelData.actionRows || []).find((a) => a.id === "default") || null
83 + readonly property bool hasDefault: !!defaultAction
79 85 MouseArea {
80 86 anchors.fill: parent
81 87 acceptedButtons: Qt.LeftButton
82 - enabled: card.compact
83 - onClicked: card.dismiss(String(card.modelData.id))
88 + enabled: card.compact || card.hasDefault
89 + onClicked: {
90 + if (card.hasDefault)
91 + card.invokeAction(String(card.modelData.id), "default");
92 + if (card.compact)
93 + card.dismiss(String(card.modelData.id));
94 + }
86 97 Row {
204 215 width: parent.width
205 216 spacing: 6
206 217 visible: !card.compact && actionModel.length > 0
207 - property var actionModel: (card.modelData.actionRows || []).filter((a) => a.kind !== "close" && a.kind !== "copy-body")
218 + property var actionModel: (card.modelData.actionRows || []).filter((a) => a.kind !== "close" && a.kind !== "copy-body" && a.id !== "default")
208 219 Repeater {
209 220 model: parent.actionModel
210 221 delegate: Rectangle {