alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
476 stars 44 forks source link

Use :transient desktop notifications #183

Open phil-s opened 11 months ago

phil-s commented 11 months ago

I'm using the following to enforce transience in all cases, but I think ement-notify--notifications-notify should either be doing this by default, or else that it should be a user option.

In my case it's as much a Gnome problem as anything else (it has a hard-coded limit for the number of persistent notifications after which subsequent notifications are rejected with an error), but my feeling is that transient would be a sane default for ement because it provides its own log buffer for persistent notifications.

;; Notifications -- force transience.
;; Otherwise I need to regularly run 'gnome-panel', purge its
;; notifications, and then kill 'gnome-panel' again.
(define-advice notifications-notify (:filter-args (params) transient)
  "Force freedesktop notifications to be transient.

Advice for `notifications-notify'.  To remove:
\(advice-remove \\='notifications-notify \\='notifications-notify@transient)"
  (plist-put params :transient t))
alphapapa commented 11 months ago

I don't think doing it by default would be good, because users might miss, e.g. a message in a direct room. It would seem to defeat the purpose of the notifications. I expect them to work basically the same as Element's notifications do on my phone.

I suspect it is largely a Gnome problem, because I'm on KDE (friendly rivalry aside), and if I sync after a long time offline, and hundreds of notifications come in, they work fine unless D-Bus itself complains of identical notifications being sent too quickly.

Anyway, I've no objection to adding an option to make them transient.