Skip to content

Commit

Permalink
Add a custom face for dismissed notifications
Browse files Browse the repository at this point in the history
This allows users to disable the default strike-through, change
colors, etc. For example:

    (set-face-attribute 'ednc-dismissed nil
                        :strike-through nil
                        :foreground "gray")

Or disable the face entirely:

    (setq ednc-dismissed-face nil)
  • Loading branch information
FrostyX committed Jan 7, 2024
1 parent d4d604f commit 0283953
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ednc.el
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
'((t (:inherit default)))
"Notification text.")

(defface ednc-dismissed
'((t (:inherit default :strike-through t)))
"Default face for dismissed notifications.")

(defcustom ednc-dismissed-face 'ednc-dismissed
"Face to be used for dismissed notifications."
:type 'face)

;;;###autoload
(define-minor-mode ednc-mode
"Act as a Desktop Notifications server and track notifications."
Expand Down Expand Up @@ -395,11 +403,11 @@ This function is destructive."
"Remove OLD notification from its log buffer, if it exists."
(cl-destructuring-bind (buffer . position)
(alist-get 'logged (ednc-notification-amendments old) '(nil))
(when (buffer-live-p buffer)
(when (and (buffer-live-p buffer) ednc-dismissed-face)
(with-current-buffer buffer
(save-excursion
(add-text-properties (goto-char position) (line-end-position)
'(face (:strike-through t))))))))
`(face ,ednc-dismissed-face)))))))

(defun ednc--append-new-notification-to-log-buffer (new)
"Append NEW notification to log buffer."
Expand Down

0 comments on commit 0283953

Please sign in to comment.