mu4e-notification: ignore dbus errors

notifications protocol says that an empty dbus error message is sent
back when the notification to close no longer exists:
https://specifications.freedesktop.org/notification-spec/latest/protocol.html#command-close-notification

Some notification daemons don't signal errors, but others do (e.g.
EDNC). Adjust the code to be conformant to the spec.
This commit is contained in:
Sergey Trofimov
2025-05-25 09:59:11 +02:00
parent 9f08397fdd
commit 88ce65df40

View File

@ -73,9 +73,11 @@ zero."
(when-let* ((fav (mu4e-bookmark-favorite))
(delta-unread (plist-get fav :delta-unread)))
(when (and (fboundp 'notifications-close-notification)
(fboundp 'dbus-ignore-errors)
mu4e--notification-id
(zerop delta-unread))
(notifications-close-notification mu4e--notification-id)
(dbus-ignore-errors
(notifications-close-notification mu4e--notification-id))
(setq mu4e--notification-id nil))
(when (and (> delta-unread 0)
(not (= delta-unread mu4e--last-delta-unread)))