mirror of
https://github.com/correl/doom-modeline.git
synced 2024-12-25 19:25:39 +00:00
mu4e: add new segment that shows unread emails
This commit is contained in:
parent
54a5f45182
commit
ad73d3d874
3 changed files with 32 additions and 4 deletions
|
@ -119,6 +119,9 @@ The icons may not be showed correctly in terminal and on Windows.")
|
|||
(defvar doom-modeline-version t
|
||||
"Whether display environment version or not.")
|
||||
|
||||
(defvar doom-modeline-mu4e t
|
||||
"Whether display mu4e notifications or not. Requires `mu4e-alert' package.")
|
||||
|
||||
|
||||
;;
|
||||
;; Custom faces
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
(defvar text-scale-mode-amount)
|
||||
(defvar winum-auto-setup-mode-line)
|
||||
(defvar xah-fly-insert-state-q)
|
||||
(defvar mu4e-alert-mode-line)
|
||||
|
||||
(declare-function anzu--reset-status 'anzu)
|
||||
(declare-function anzu--where-is-here 'anzu)
|
||||
|
@ -1497,6 +1498,25 @@ mouse-1: Toggle Debug on Quit"
|
|||
(eval `(pdf-view-current-page))
|
||||
(pdf-cache-number-of-pages))))
|
||||
|
||||
|
||||
;;
|
||||
;; mu4e-alert notifications
|
||||
;;
|
||||
|
||||
(doom-modeline-def-segment mu4e
|
||||
(when (and doom-modeline-mu4e
|
||||
(doom-modeline--active)
|
||||
;; we'll do our own formatting so just need to test for zero
|
||||
(> mu4e-alert-mode-line 0))
|
||||
;; remove mu4e-alert's global modeline string setting
|
||||
(setq global-mode-string (delete '(:eval mu4e-alert-mode-line)
|
||||
global-mode-string))
|
||||
(propertize
|
||||
(number-to-string mu4e-alert-mode-line)
|
||||
'help-echo (if (= mu4e-alert-mode-line 1)
|
||||
"You have an unread email"
|
||||
(format "You have %s unread emails" mu4e-alert-mode-line)))))
|
||||
|
||||
(provide 'doom-modeline-segments)
|
||||
|
||||
;;; doom-modeline-segments.el ends here
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
(doom-modeline-def-modeline 'main
|
||||
'(bar workspace-number window-number evil-state god-state ryo-modal xah-fly-keys matches buffer-info remote-host buffer-position parrot selection-info)
|
||||
'(misc-info persp-name lsp github debug minor-modes input-method buffer-encoding major-mode process vcs checker))
|
||||
'(misc-info persp-name lsp mu4e github debug minor-modes input-method buffer-encoding major-mode process vcs checker))
|
||||
|
||||
(doom-modeline-def-modeline 'minimal
|
||||
'(bar matches " " buffer-info)
|
||||
|
@ -95,7 +95,7 @@
|
|||
|
||||
(doom-modeline-def-modeline 'project
|
||||
'(bar " " buffer-default-directory)
|
||||
'(misc-info github debug " " major-mode " "))
|
||||
'(misc-info mu4e github debug " " major-mode " "))
|
||||
|
||||
(doom-modeline-def-modeline 'media
|
||||
'(bar window-number buffer-size buffer-info)
|
||||
|
@ -153,6 +153,8 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
|
|||
;;
|
||||
|
||||
(defvar doom-modeline--default-mode-line mode-line-format)
|
||||
(defvar mu4e-alert-modeline-formatter)
|
||||
(declare-function mu4e-alert-default-mode-line-formatter 'mu4e-alert)
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode doom-modeline-mode
|
||||
|
@ -174,7 +176,8 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
|
|||
(add-hook 'dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
||||
(add-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
|
||||
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
||||
(add-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline))
|
||||
(add-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline)
|
||||
(setq mu4e-alert-modeline-formatter #'identity))
|
||||
(progn
|
||||
;; Restore mode-line
|
||||
(setq-default mode-line-format doom-modeline--default-mode-line)
|
||||
|
@ -182,7 +185,9 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
|
|||
(remove-hook 'dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
||||
(remove-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
|
||||
(remove-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
||||
(remove-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline))))
|
||||
(remove-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline)
|
||||
(setq mu4e-alert-modeline-formatter
|
||||
#'mu4e-alert-default-mode-line-formatter))))
|
||||
|
||||
(provide 'doom-modeline)
|
||||
|
||||
|
|
Loading…
Reference in a new issue