Improve icons for the persp-name segment.

This commit is contained in:
Vincent Zhang 2019-07-02 13:52:00 +08:00
parent 24fd535a69
commit fd52978a97
3 changed files with 26 additions and 19 deletions

View file

@ -101,6 +101,9 @@ It returns a file name which can be used directly as argument of
("pause" . "\xe034")
("priority_high" . "\xe645")
;; Persp
("aspect_ratio" . "\xe85b")
;; LSP
("rocket" . "\xf135")

View file

@ -1332,28 +1332,32 @@ Requires `eyebrowse-mode' to be enabled."
(let* ((persp (get-current-persp))
(name (safe-persp-name persp))
(icon (if (and doom-modeline-icon doom-modeline-persp-name-icon)
(concat (doom-modeline-icon-material "aspect_ratio" :v-adjust -0.17) (doom-modeline-spc))
"#")))
(doom-modeline-icon-material "aspect_ratio" :v-adjust -0.225)
"#"))
(face (if (and persp
(not (persp-contain-buffer-p (current-buffer) persp)))
'doom-modeline-persp-buffer-not-in-persp
'doom-modeline-persp-name)))
(unless (string-equal persp-nil-name name)
(concat
(doom-modeline-spc)
(propertize
(format "%s%s" icon name)
'face (if (and persp
(not (persp-contain-buffer-p (current-buffer) persp)))
'doom-modeline-persp-buffer-not-in-persp
'doom-modeline-persp-name)
'help-echo "mouse-1: Switch perspective
(propertize icon
'face `(:inherit ,(get-text-property 0 'face icon)
:inherit ,face))
(doom-modeline-vspc)
(propertize name
'face face
'help-echo "mouse-1: Switch perspective
mouse-2: Show help for minor mode"
'mouse-face 'mode-line-highlight
'local-map (let ((map (make-sparse-keymap)))
(define-key map [mode-line mouse-1]
#'persp-switch)
(define-key map [mode-line mouse-2]
(lambda ()
(interactive)
(describe-function 'persp-mode)))
map))
'mouse-face 'mode-line-highlight
'local-map (let ((map (make-sparse-keymap)))
(define-key map [mode-line mouse-1]
#'persp-switch)
(define-key map [mode-line mouse-2]
(lambda ()
(interactive)
(describe-function 'persp-mode)))
map))
(doom-modeline-spc)))))))
(add-hook 'find-file-hook #'doom-modeline-update-persp-name)

View file

@ -4,7 +4,7 @@
;; Author: Vincent Zhang <seagle0128@gmail.com>
;; Homepage: https://github.com/seagle0128/doom-modeline
;; Version: 2.3.6
;; Version: 2.3.7
;; Package-Requires: ((emacs "25.1") (all-the-icons "1.0.0") (shrink-path "0.2.0") (dash "2.11.0"))
;; Keywords: faces mode-line