Drop notification action buttons now that the Pinyin prompt is suppressed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier HanssonandClaude Opus 5.5 committed 2026-10-11 07:51:59 +09:00
1 parent d579157881
commit 8b5ebc57bf
4 files changed
+2 -58

No files matched your search

@@ -185,12 +185,6 @@ function snapshotOf(notification, timestamp) {
var id = n.id || 0 var id = n.id || 0
var expireTimeout = Number(n.expireTimeout || 0) var expireTimeout = Number(n.expireTimeout || 0)
if (!isFinite(expireTimeout) || expireTimeout < 0) 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 { return {
id: id, id: id,
originalId: id, originalId: id,
@@ -201,7 +195,6 @@ function snapshotOf(notification, timestamp) {
image: n.image || "", image: n.image || "",
glyph: glyphFromHints(n.hints), glyph: glyphFromHints(n.hints),
execArgv: execArgvFromHints(n.hints), execArgv: execArgvFromHints(n.hints),
actionsJson: JSON.stringify(actions),
urgency: n.urgency, urgency: n.urgency,
expireTimeout: expireTimeout, expireTimeout: expireTimeout,
timestamp: timestamp === undefined ? Date.now() : timestamp timestamp: timestamp === undefined ? Date.now() : timestamp
@@ -210,7 +203,7 @@ function snapshotOf(notification, timestamp) {
// Everything the popup card draws, and therefore everything an in-place // Everything the popup card draws, and therefore everything an in-place
// update has to write through to the row and its file. // update has to write through to the row and its file.
var POPUP_ROLES = ["app", "appIcon", "summary", "body", "image", "glyph", "execArgv", "actionsJson", "urgency", "expireTimeout"] var POPUP_ROLES = ["app", "appIcon", "summary", "body", "image", "glyph", "execArgv", "urgency", "expireTimeout"]
function popupRoles() { function popupRoles() {
return POPUP_ROLES return POPUP_ROLES
@@ -270,8 +263,6 @@ function historyEntry(value, normalUrgency) {
image: e.image || "", image: e.image || "",
glyph: e.glyph || "", glyph: e.glyph || "",
execArgv: e.execArgv || "", execArgv: e.execArgv || "",
// Libnotify actions belong to a live sender; never replay stale buttons.
actionsJson: "[]",
urgency: typeof e.urgency === "number" ? e.urgency : normalUrgency, urgency: typeof e.urgency === "number" ? e.urgency : normalUrgency,
expireTimeout: 0, expireTimeout: 0,
timestamp: e.timestamp || 0 timestamp: e.timestamp || 0
+1 -21
View File
@@ -239,7 +239,7 @@ Item {
// about after the popup exists. // about after the popup exists.
readonly property var updateSignals: [ readonly property var updateSignals: [
"summaryChanged", "bodyChanged", "appNameChanged", "appIconChanged", "summaryChanged", "bodyChanged", "appNameChanged", "appIconChanged",
"imageChanged", "urgencyChanged", "expireTimeoutChanged", "hintsChanged", "actionsChanged" "imageChanged", "urgencyChanged", "expireTimeoutChanged", "hintsChanged"
] ]
// A client that updates a notification through replaces_id does not produce // A client that updates a notification through replaces_id does not produce
@@ -431,26 +431,10 @@ Item {
// libnotify action — they just expect clicking the notification to // libnotify action — they just expect clicking the notification to
// focus their window. Fall back to focusing the sending app by class so // focus their window. Fall back to focusing the sending app by class so
// that click-to-jump actually works. // that click-to-jump actually works.
if (!invoked && entry.actionsJson && entry.actionsJson !== "[]") return
if (!invoked) focusApp(entry) if (!invoked) focusApp(entry)
dismissPopup(index) dismissPopup(index)
} }
function invokePopupAction(index, identifier) {
if (index < 0 || index >= popupModel.count) return
var entry = popupModel.get(index)
var ref = entry && !isRestoredRow(entry) ? liveRefs[entry.originalId] : null
if (!ref || !ref.actions) return
for (var i = 0; i < ref.actions.length; i++) {
var action = ref.actions[i]
if (action && action.identifier === identifier) {
action.invoke()
dismissPopup(index)
return
}
}
}
// Try to focus an existing Hyprland window matching the notification's // Try to focus an existing Hyprland window matching the notification's
// sender. The helper handles case-insensitive class matching. // sender. The helper handles case-insensitive class matching.
function focusApp(entry) { function focusApp(entry) {
@@ -746,7 +730,6 @@ Item {
image: "", image: "",
glyph: "󰂚", glyph: "󰂚",
execArgv: "", execArgv: "",
actionsJson: "[]",
urgency: NotificationUrgency.Low, urgency: NotificationUrgency.Low,
expireTimeout: 0, expireTimeout: 0,
timestamp: Date.now() timestamp: Date.now()
@@ -1065,7 +1048,6 @@ Item {
required property string body required property string body
required property string image required property string image
required property string glyph required property string glyph
required property string actionsJson
required property int urgency required property int urgency
required property double expireTimeout required property double expireTimeout
required property double timestamp required property double timestamp
@@ -1117,11 +1099,9 @@ Item {
cornerRadius: service.cornerRadius cornerRadius: service.cornerRadius
fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : "" fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : ""
glyph: cardSlot.glyph glyph: cardSlot.glyph
actions: JSON.parse(cardSlot.actionsJson || "[]")
onCloseRequested: service.dismissPopup(cardSlot.index) onCloseRequested: service.dismissPopup(cardSlot.index)
onCardClicked: service.invokePopupDefault(cardSlot.index) onCardClicked: service.invokePopupDefault(cardSlot.index)
onActionClicked: identifier => service.invokePopupAction(cardSlot.index, identifier)
} }
} }
} }
@@ -27,7 +27,6 @@ BorderSurface {
property int urgency: 1 property int urgency: 1
property double timestamp: 0 property double timestamp: 0
property int cornerRadius: 0 property int cornerRadius: 0
property var actions: []
// System monospace font injected by the container. // System monospace font injected by the container.
property string fontFamily: "" property string fontFamily: ""
@@ -36,7 +35,6 @@ BorderSurface {
signal closeRequested() signal closeRequested()
signal cardClicked() signal cardClicked()
signal actionClicked(string identifier)
// Prefer per-notification media/avatar data, then fall back to the app icon. // Prefer per-notification media/avatar data, then fall back to the app icon.
// The `check` flag avoids Qt's missing-texture placeholder for unknown names. // The `check` flag avoids Qt's missing-texture placeholder for unknown names.
readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon)
@@ -196,27 +194,6 @@ BorderSurface {
} }
} }
} }
Flow {
Layout.fillWidth: true
Layout.leftMargin: Style.space(12)
Layout.rightMargin: Style.space(12)
Layout.bottomMargin: visible ? Style.space(10) : 0
visible: root.actions.length > 0
spacing: Style.space(8)
Repeater {
model: root.actions
delegate: Button {
required property var modelData
text: modelData.text
bordered: true
foreground: Color.notifications.text
fontFamily: root.fontFamily
onClicked: root.actionClicked(modelData.identifier)
}
}
}
} }
// Hover-revealed close. Stacked after mainColumn so its MouseArea sits // Hover-revealed close. Stacked after mainColumn so its MouseArea sits
-4
View File
@@ -283,10 +283,6 @@ const notification = {
expireTimeout: 1.5 expireTimeout: 1.5
} }
const snapshot = notifications.snapshotOf(notification, 12345) const snapshot = notifications.snapshotOf(notification, 12345)
assertDeepEqual(JSON.parse(notifications.snapshotOf({ actions: [
{ identifier: 'default', text: 'Open' }, { identifier: 'yes', text: 'Yes' }, { identifier: 'no', text: 'No' }
]}).actionsJson), [{ identifier: 'yes', text: 'Yes' }, { identifier: 'no', text: 'No' }], 'explicit choices appear independently of the default card action')
assertEqual(notifications.popupEntry({ actionsJson: '[{"identifier":"yes","text":"Yes"}]' }, 1).actionsJson, '[]', 'restored notifications do not replay actions from a dead sender')
assertDeepEqual( assertDeepEqual(
{ {
id: snapshot.id, id: snapshot.id,