Bug 447385 - After KDE connect starts, calling org.freedesktop.Notifications.Notify returns incorrect ids when replaceId=0, making replacing notifications impossible
Summary: After KDE connect starts, calling org.freedesktop.Notifications.Notify return...
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: common (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
: 463782 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-12-22 13:31 UTC by Alexander Bantyev
Modified: 2023-03-13 02:20 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Bantyev 2021-12-22 13:31:37 UTC
SUMMARY

When KDE connect (the sendnotifications plugin specifically) starts,
calling the `Notify` method on `org.freedesktop.Notifications` with
`replace_id == 0` returns incorrect ids. From my understanding, these
IDs are KDE Connect's internal ids assigned to notifications, and not
the notification manager's IDs. With more spec-relaxed servers, such
as Dunst, it is a lot less annoying since they just allow us to use
KDE Connect's internal notification IDs.

With spec-strict servers (like Mako), this makes it almost impossible
to replace notifications, since the IDs clients get from D-Bus are
useless.

STEPS TO REPRODUCE

1. Make sure you are running a notification manager which is strict about notification IDs, e.g. Mako
2. `curl https://raw.githubusercontent.com/vlevit/notify-send.sh/master/notify-send.sh > notify-send; chmod +x notify-send`
3. Start kdeconnectd with sendnotifications plugin enabled, and connect to a device (make sure that the sendnotifications plugin activates)
4. Run `./notify-send -R test test` repeatedly

OBSERVED RESULT

Multiple notifications appear, one for each `notify-send` invocation

EXPECTED RESULT

Only one notification appears (and gets updated on new notify-send invocations)

SOFTWARE/OS VERSIONS

NixOS GNU/Linux 21.11pre (nixpkgs 263ef4cc4146c9fab808085487438c625d4426a9)
Sway 1.6.1
Mako 1.6
kdeconnect 21.08.3
Comment 1 Fushan Wen 2023-01-03 15:58:18 UTC
*** Bug 463782 has been marked as a duplicate of this bug. ***
Comment 2 Bug Janitor Service 2023-01-03 16:14:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/516
Comment 3 Bug Janitor Service 2023-03-11 15:42:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/528
Comment 4 Fushan Wen 2023-03-13 02:20:26 UTC
Git commit 4523ba588276bc5d2bc7f0e11cf39743efeca263 by Fushan Wen.
Committed on 13/03/2023 at 02:20.
Pushed by fusionfuture into branch 'master'.

Use `org.freedesktop.DBus.Monitoring` to monitor notifications

Plasma notification widget also uses the interface, and sometimes
notification ids can become out of sync between the two DBus adaptors.
FIXED-IN: 23.08

M  +1    -0    CMakeLists.txt
M  +1    -0    plugins/sendnotifications/CMakeLists.txt
M  +169  -69   plugins/sendnotifications/notificationslistener.cpp
M  +10   -7    plugins/sendnotifications/notificationslistener.h

https://invent.kde.org/network/kdeconnect-kde/commit/4523ba588276bc5d2bc7f0e11cf39743efeca263