mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
Merge pull request #110 from seanfarley/smf/irc
Add irc / circe segment
This commit is contained in:
commit
8e2fff521f
3 changed files with 64 additions and 2 deletions
|
@ -122,6 +122,11 @@ The icons may not be showed correctly in terminal and on Windows.")
|
||||||
(defvar doom-modeline-mu4e t
|
(defvar doom-modeline-mu4e t
|
||||||
"Whether display mu4e notifications or not. Requires `mu4e-alert' package.")
|
"Whether display mu4e notifications or not. Requires `mu4e-alert' package.")
|
||||||
|
|
||||||
|
(defvar doom-modeline-irc t
|
||||||
|
"Whether display irc notifications or not. Requires `circe' package.")
|
||||||
|
|
||||||
|
(defvar doom-modeline-irc-stylize 'identity
|
||||||
|
"Function to stylize the irc buffer names.")
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Custom faces
|
;; Custom faces
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
(defvar winum-auto-setup-mode-line)
|
(defvar winum-auto-setup-mode-line)
|
||||||
(defvar xah-fly-insert-state-q)
|
(defvar xah-fly-insert-state-q)
|
||||||
(defvar mu4e-alert-mode-line)
|
(defvar mu4e-alert-mode-line)
|
||||||
|
(defvar tracking-buffers)
|
||||||
|
|
||||||
(declare-function anzu--reset-status 'anzu)
|
(declare-function anzu--reset-status 'anzu)
|
||||||
(declare-function anzu--where-is-here 'anzu)
|
(declare-function anzu--where-is-here 'anzu)
|
||||||
|
@ -130,6 +131,7 @@
|
||||||
(declare-function winum--clear-mode-line 'winum)
|
(declare-function winum--clear-mode-line 'winum)
|
||||||
(declare-function winum--install-mode-line 'winum)
|
(declare-function winum--install-mode-line 'winum)
|
||||||
(declare-function winum-get-number-string 'winum)
|
(declare-function winum-get-number-string 'winum)
|
||||||
|
(declare-function tracking-shorten 'tracking)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -1519,6 +1521,61 @@ mouse-1: Toggle Debug on Quit"
|
||||||
"You have an unread email"
|
"You have an unread email"
|
||||||
(format "You have %s unread emails" mu4e-alert-mode-line)))))
|
(format "You have %s unread emails" mu4e-alert-mode-line)))))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; irc notifications
|
||||||
|
;;
|
||||||
|
|
||||||
|
(defun doom-modeline--shorten-irc (name)
|
||||||
|
"Wrapper for `tracking-shorten' that only takes one NAME.
|
||||||
|
|
||||||
|
One key difference is that when `tracking-shorten' returns nil we
|
||||||
|
will instead return the original value of name. This is necessary
|
||||||
|
in cases where the user has stylized the name to be an icon and
|
||||||
|
we don't want to remove that so we just return the original."
|
||||||
|
(or (car (tracking-shorten (list name)))
|
||||||
|
name))
|
||||||
|
|
||||||
|
(defun doom-modeline--tracking-buffers (buffers)
|
||||||
|
"Logic to convert some irc BUFFERS to their font-awesome icon."
|
||||||
|
(mapconcat
|
||||||
|
(lambda (b)
|
||||||
|
(propertize
|
||||||
|
(doom-modeline--shorten-irc (funcall doom-modeline-irc-stylize b))
|
||||||
|
'face '(:inherit (warning doom-modeline-unread-number))
|
||||||
|
'help-echo b))
|
||||||
|
buffers
|
||||||
|
;; `space-width' only affects the width of the spaces here, so we can tighten
|
||||||
|
;; it to be a bit more compact
|
||||||
|
(propertize " · " 'display '(space-width 0.4))))
|
||||||
|
|
||||||
|
;; create a modeline segment that contains all the irc tracked buffers
|
||||||
|
(doom-modeline-def-segment irc-buffers
|
||||||
|
"The list of shortened, unread irc buffers."
|
||||||
|
(when (and doom-modeline-irc
|
||||||
|
(boundp 'tracking-mode-line-buffers)
|
||||||
|
(doom-modeline--active)
|
||||||
|
(derived-mode-p 'circe-mode))
|
||||||
|
;; add a space at the end to pad against the following segment
|
||||||
|
(concat " " (doom-modeline--tracking-buffers tracking-buffers) " ")))
|
||||||
|
|
||||||
|
(doom-modeline-def-segment irc
|
||||||
|
"A notification icon for any unread irc buffer."
|
||||||
|
(when (and doom-modeline-irc
|
||||||
|
(boundp 'tracking-mode-line-buffers)
|
||||||
|
(> (length tracking-buffers) 0)
|
||||||
|
(doom-modeline--active))
|
||||||
|
(concat
|
||||||
|
" "
|
||||||
|
(propertize (doom-modeline-icon-material "sms"
|
||||||
|
:height 0.9
|
||||||
|
:face 'doom-modeline-warning)
|
||||||
|
'help-echo (format "IRC Notifications: %s"
|
||||||
|
(doom-modeline--tracking-buffers
|
||||||
|
tracking-buffers))
|
||||||
|
'display '(raise -0.17))
|
||||||
|
" ")))
|
||||||
|
|
||||||
(provide 'doom-modeline-segments)
|
(provide 'doom-modeline-segments)
|
||||||
|
|
||||||
;;; doom-modeline-segments.el ends here
|
;;; doom-modeline-segments.el ends here
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
(doom-modeline-def-modeline 'main
|
(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)
|
'(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 mu4e github debug minor-modes input-method buffer-encoding major-mode process vcs checker))
|
'(misc-info persp-name lsp irc mu4e github debug minor-modes input-method buffer-encoding major-mode process vcs checker))
|
||||||
|
|
||||||
(doom-modeline-def-modeline 'minimal
|
(doom-modeline-def-modeline 'minimal
|
||||||
'(bar matches " " buffer-info)
|
'(bar matches " " buffer-info)
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
|
|
||||||
(doom-modeline-def-modeline 'special
|
(doom-modeline-def-modeline 'special
|
||||||
'(bar window-number evil-state god-state ryo-modal xah-fly-keys matches buffer-info-simple buffer-position parrot selection-info)
|
'(bar window-number evil-state god-state ryo-modal xah-fly-keys matches buffer-info-simple buffer-position parrot selection-info)
|
||||||
'(misc-info lsp debug minor-modes input-method buffer-encoding major-mode process checker))
|
'(misc-info lsp debug minor-modes input-method irc-buffers buffer-encoding major-mode process checker))
|
||||||
|
|
||||||
(doom-modeline-def-modeline 'project
|
(doom-modeline-def-modeline 'project
|
||||||
'(bar " " buffer-default-directory)
|
'(bar " " buffer-default-directory)
|
||||||
|
|
Loading…
Reference in a new issue