Bug 501244 - Notifications created through the Notification portal with `default-action` do not have ActionInvoked signals emitted when clicked
Summary: Notifications created through the Notification portal with `default-action` d...
Status: RESOLVED FIXED
Alias: None
Product: xdg-desktop-portal-kde
Classification: Plasma
Component: general (show other bugs)
Version: 6.3.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-08 23:57 UTC by Kye
Modified: 2025-03-27 22:06 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kye 2025-03-08 23:57:56 UTC
SUMMARY
Notifications created through the Notification portal do not have ActionInvoked signals emitted when clicked 

STEPS TO REPRODUCE
1. Create a notification with the Notification portal with an action. I'm doing this by running an electron app with libnotify within a flatpak & executing `new Notification("hi").onclick = () => console.log("clicked")`
2. Click the notification

OBSERVED RESULT
When clicking the notification no ActionInvoked signal is emitted. confirmed by seeing no "clicked" log message. Running dbus-monitor shows the signal is not fired. 

EXPECTED RESULT
The signal is fired allowing the app to trigger actions while sandboxxed.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.3.2
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION
libnotify uses the raw dbus protocol when not sandboxed which is why this isnt an issue for non-sandboxxed apps. ActionInvoked is triggered correctly on click when creating the notification with the Notify method.
Comment 1 Bug Janitor Service 2025-03-09 00:34:25 UTC
Thank you for the bug report!

However Plasma 6.2.5 is no longer eligible for support or maintenance from KDE; supported versions are 5.27. (LTS), and 6.3 (non-LTS) or newer. Please upgrade to a supported version as soon as your distribution makes it available to you. Plasma is a fast-moving project, and bugs in one version are often fixed in the next one.

If you need support for Plasma 6.2.5, please contact your distribution, who bears the responsibility of providing support for older releases that are no longer supported by KDE.

If you can reproduce the issue after upgrading to a supported version, feel free to re-open this bug report.
Comment 2 Kye 2025-03-09 05:09:35 UTC
oops I mistagged
Comment 3 Nicolas Fella 2025-03-09 15:44:45 UTC
Notifications can only be clicked when they have a default action. Are you sure your notification has that?

As far as I can tell xdg-desktop-portal-kde works as expected, tested with xdg-portal-test-kde and ashpd-demo.

I'd suspect that this is broken on the application side. https://gitlab.gnome.org/GNOME/libnotify/-/issues/50 seems relevant
Comment 4 Nate Graham 2025-03-11 22:02:50 UTC
.
Comment 5 Kye 2025-03-23 20:47:45 UTC
Sorry for the slow reply, the issue you linked is most definitely related as the reporter is also on Plasma.. Notifications created through the portal with `default-action` on Gnome handle click events just fine which is what lead to me reporting it against kde.

Looking further tho shows that libnotify is creating these `default-action` notifications without a `default-action-target`. Ashpd-demo does so I can confirm its not KDE's fault. Odd that Gnome's portal works without `default-action-target`
Comment 6 Kye 2025-03-23 20:55:17 UTC
Actually I just realized that `default-action-target` is optional so this is kde's fault?

```
ASHPD Demo:

method call time=1742763220.456704 sender=:1.1105 -> destination=org.freedesktop.portal.Desktop serial=36 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Notification; member=AddNotification
   string "ashpd"
   array [
      dict entry(
         string "title"
         variant             string ""
      )
      dict entry(
         string "body"
         variant             string ""
      )
      dict entry(
         string "priority"
         variant             string "high"
      )
      dict entry(
         string "default-action"
         variant             string ""
      )
      dict entry(
         string "default-action-target"
         variant             variant                string ""
      )
   ]
signal time=1742763223.140762 sender=:1.17 -> destination=:1.1105 serial=5089 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Notification; member=ActionInvoked
   string "ashpd"
   string ""
   array [
      variant          variant             string ""
   ]


Electron with the mentioned JS:

method call time=1742763231.236882 sender=:1.1107 -> destination=:1.17 serial=31 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Notification; member=AddNotification
   string "libnotify-flatpak.(null)-electron-2"
   array [
      dict entry(
         string "title"
         variant             string ""
      )
      dict entry(
         string "body"
         variant             string ""
      )
      dict entry(
         string "default-action"
         variant             string "default"
      )
      dict entry(
         string "priority"
         variant             string "normal"
      )
   ]
```
Comment 7 Bug Janitor Service 2025-03-23 22:50:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/371
Comment 8 Nate Graham 2025-03-27 22:06:18 UTC
Fixed by Kylie CT with https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/1210bd0c654d92e3eddca2da405c454fed540125 in Plasma 6.4.1!