Show explicit choices on notification cards

This commit is contained in:
David Heinemeier Hansson committed 2026-10-07 17:35:03 +02:00
1 parent 35f8eef1bc
commit 036e501e58
4 files changed
+58 -2

No files matched your search

@@ -185,6 +185,12 @@ function snapshotOf(notification, timestamp) {
var id = n.id || 0
var expireTimeout = Number(n.expireTimeout || 0)
if (!isFinite(expireTimeout) || expireTimeout < 0) expireTimeout = 0
var actions = []
for (var i = 0; n.actions && i < n.actions.length; i++) {
var action = n.actions[i]
if (action && action.identifier && action.identifier !== "default")
actions.push({ identifier: String(action.identifier), text: String(action.text || action.identifier) })
}
return {
id: id,
originalId: id,
@@ -195,6 +201,7 @@ function snapshotOf(notification, timestamp) {
image: n.image || "",
glyph: glyphFromHints(n.hints),
execArgv: execArgvFromHints(n.hints),
actionsJson: JSON.stringify(actions),
// Pinyin's first-use cloud prediction question needs an explicit answer.
// Its normal urgency otherwise dismisses it before users can read it.
urgency: n.appName === "Pinyin" && n.appIcon === "fcitx-pinyin" ? 2 : n.urgency,
@@ -205,7 +212,7 @@ function snapshotOf(notification, timestamp) {
// Everything the popup card draws, and therefore everything an in-place
// update has to write through to the row and its file.
var POPUP_ROLES = ["app", "appIcon", "summary", "body", "image", "glyph", "execArgv", "urgency", "expireTimeout"]
var POPUP_ROLES = ["app", "appIcon", "summary", "body", "image", "glyph", "execArgv", "actionsJson", "urgency", "expireTimeout"]
function popupRoles() {
return POPUP_ROLES
@@ -265,6 +272,8 @@ function historyEntry(value, normalUrgency) {
image: e.image || "",
glyph: e.glyph || "",
execArgv: e.execArgv || "",
// Libnotify actions belong to a live sender; never replay stale buttons.
actionsJson: "[]",
urgency: typeof e.urgency === "number" ? e.urgency : normalUrgency,
expireTimeout: 0,
timestamp: e.timestamp || 0