diff --git a/shell/plugins/notifications/NotificationLogic.js b/shell/plugins/notifications/NotificationLogic.js index d3632827..6ba2b6ab 100644 --- a/shell/plugins/notifications/NotificationLogic.js +++ b/shell/plugins/notifications/NotificationLogic.js @@ -185,12 +185,6 @@ 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, @@ -201,7 +195,6 @@ function snapshotOf(notification, timestamp) { image: n.image || "", glyph: glyphFromHints(n.hints), execArgv: execArgvFromHints(n.hints), - actionsJson: JSON.stringify(actions), urgency: n.urgency, expireTimeout: expireTimeout, 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 // 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() { return POPUP_ROLES @@ -270,8 +263,6 @@ 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 diff --git a/shell/plugins/notifications/Service.qml b/shell/plugins/notifications/Service.qml index 6f63b2b1..a239b19f 100644 --- a/shell/plugins/notifications/Service.qml +++ b/shell/plugins/notifications/Service.qml @@ -239,7 +239,7 @@ Item { // about after the popup exists. readonly property var updateSignals: [ "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 @@ -431,26 +431,10 @@ Item { // libnotify action — they just expect clicking the notification to // focus their window. Fall back to focusing the sending app by class so // that click-to-jump actually works. - if (!invoked && entry.actionsJson && entry.actionsJson !== "[]") return if (!invoked) focusApp(entry) 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 // sender. The helper handles case-insensitive class matching. function focusApp(entry) { @@ -746,7 +730,6 @@ Item { image: "", glyph: "󰂚", execArgv: "", - actionsJson: "[]", urgency: NotificationUrgency.Low, expireTimeout: 0, timestamp: Date.now() @@ -1065,7 +1048,6 @@ Item { required property string body required property string image required property string glyph - required property string actionsJson required property int urgency required property double expireTimeout required property double timestamp @@ -1117,11 +1099,9 @@ Item { cornerRadius: service.cornerRadius fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : "" glyph: cardSlot.glyph - actions: JSON.parse(cardSlot.actionsJson || "[]") onCloseRequested: service.dismissPopup(cardSlot.index) onCardClicked: service.invokePopupDefault(cardSlot.index) - onActionClicked: identifier => service.invokePopupAction(cardSlot.index, identifier) } } } diff --git a/shell/plugins/notifications/components/NotificationCard.qml b/shell/plugins/notifications/components/NotificationCard.qml index 220324e2..5634e2ee 100644 --- a/shell/plugins/notifications/components/NotificationCard.qml +++ b/shell/plugins/notifications/components/NotificationCard.qml @@ -27,7 +27,6 @@ BorderSurface { property int urgency: 1 property double timestamp: 0 property int cornerRadius: 0 - property var actions: [] // System monospace font injected by the container. property string fontFamily: "" @@ -36,7 +35,6 @@ BorderSurface { signal closeRequested() signal cardClicked() - signal actionClicked(string identifier) // 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. 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 diff --git a/test/shell.d/notifications-test.sh b/test/shell.d/notifications-test.sh index fb410755..91349e15 100644 --- a/test/shell.d/notifications-test.sh +++ b/test/shell.d/notifications-test.sh @@ -283,10 +283,6 @@ const notification = { expireTimeout: 1.5 } 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( { id: snapshot.id,