branch: elpa/mastodon
commit 6a7b8139628b101691b291b468e4c79eb5de0ccf
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>
add `mastodon-notifications-notify-shown` variable, avoid repeat alerts.
#249
---
lisp/mastodon-notifications.el | 7 +++++--
lisp/mastodon.el | 9 +++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 1f128ef417..8f16b78aed 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -851,9 +851,12 @@ Status notifications are created when you call
"Send a desktop notification when we have unread notifications.
Uses `notifications-notify'."
(let ((count (or count (mastodon-notifications--get-unread-count))))
- (when (> count 0)
+ (when (and (> count 0)
+ (not mastodon-notifications-notify-shown))
(alert (format "New notifications: <b>%s</b>" count)
- :title "mastodon.el"))))
+ :title "mastodon.el")
+ ;; we nil this in `mastodon-notifications-get':
+ (setq mastodon-notifications-notify-shown t))))
;;; NOTIFICATION REQUESTS / FILTERING / POLICY
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index c57ebafee7..42fac384c4 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -118,6 +118,9 @@
"List of notification types for which grouping is implemented.
Used in `mastodon-notifications-get'")
+(defvar mastodon-notifications-notify-shown nil
+ "Whether recent notifications have been seen by the user or not.")
+
(defgroup mastodon nil
"Interface with Mastodon."
:prefix "mastodon-"
@@ -207,7 +210,7 @@ and X others...\"."
(defcustom mastodon-notifications-alert-style alert-default-style
"The type of alert.el style to use for mastodon.el notification alerts.
-Currently, if you customize this variable, you need to restart emacs for
+Currently, if you customize this variable, you need to restart Emacs for
it to take effect, or if you don't have any other alert.el rules set up,
you can nil `alert-internal-configuration' and reload mastodon.el"
:type
@@ -476,7 +479,9 @@ MAX-ID is a request parameter for pagination."
"v1"
"v2"))
(with-current-buffer (get-buffer-create buffer)
- (use-local-map mastodon-notifications--map))
+ (use-local-map mastodon-notifications--map)
+ (when mastodon-notifications-notify-shown
+ (setq mastodon-notifications-notify-shown nil)))
(message "Loading your notifications... Done")))
;;;###autoload