Mu4e: (Linux only) make audible bell configurable

This commit is contained in:
TEC 2021-04-15 00:41:27 +08:00
parent 32b07003fb
commit 874f140a67
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C

View file

@ -530,11 +530,16 @@ See `+mu4e-msg-gmail-p' and `mu4e-sent-messages-behavior'.")
(when IS-LINUX (when IS-LINUX
(mu4e-alert-set-default-style 'libnotify) (mu4e-alert-set-default-style 'libnotify)
(defvar +mu4e-alert-bell-cmd '("paplay" . "/usr/share/sounds/freedesktop/stereo/message.oga")
"Cons list with command to play a sound, and the sound file to play.
Disabled when set to nil.")
(setq mu4e-alert-email-notification-types '(subjects)) (setq mu4e-alert-email-notification-types '(subjects))
(defun +mu4e-alert-grouped-mail-notification-formatter-with-bell (mail-group _all-mails) (defun +mu4e-alert-grouped-mail-notification-formatter-with-bell (mail-group _all-mails)
"Default function to format MAIL-GROUP for notification. "Default function to format MAIL-GROUP for notification.
ALL-MAILS are the all the unread emails" ALL-MAILS are the all the unread emails"
(shell-command "paplay /usr/share/sounds/freedesktop/stereo/message.oga") (when +mu4e-alert-bell-cmd
(start-process (car +mu4e-alert-bell-cmd) (cdr +mu4e-alert-bell-cmd)))
(if (> (length mail-group) 1) (if (> (length mail-group) 1)
(let* ((mail-count (length mail-group)) (let* ((mail-count (length mail-group))
(first-mail (car mail-group)) (first-mail (car mail-group))