Not support variable-pitch since it breaks icons.

This commit is contained in:
Vincent Zhang 2019-03-07 04:04:03 +07:00
parent 5c926b81de
commit 23b9ffb762
4 changed files with 14 additions and 31 deletions

View file

@ -150,9 +150,6 @@ Strongly recommend to use
;; Please refer to https://github.com/bbatsov/projectile/issues/657. ;; Please refer to https://github.com/bbatsov/projectile/issues/657.
(setq doom-modeline-buffer-file-name-style 'truncate-upto-project) (setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
;; If non-nil, the mode-line is displayed with the `variable-pitch' face.
(setq doom-modeline-enable-variable-pitch nil)
;; Whether show `all-the-icons' or not (if nil nothing will be showed). ;; Whether show `all-the-icons' or not (if nil nothing will be showed).
(setq doom-modeline-icon t) (setq doom-modeline-icon t)

View file

@ -86,9 +86,6 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
file-name => comint.el file-name => comint.el
buffer-name => comint.el<2> (uniquify buffer name)") buffer-name => comint.el<2> (uniquify buffer name)")
(defvar doom-modeline-enable-variable-pitch nil
"If non-nil, the mode-line is displayed with the `variable-pitch' face.")
(defvar doom-modeline-icon (display-graphic-p) (defvar doom-modeline-icon (display-graphic-p)
"Whether show `all-the-icons' or not. "Whether show `all-the-icons' or not.
@ -425,24 +422,6 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
(add-hook 'focus-in-hook #'doom-modeline-focus) (add-hook 'focus-in-hook #'doom-modeline-focus)
(add-hook 'focus-out-hook #'doom-modeline-unfocus)))) (add-hook 'focus-out-hook #'doom-modeline-unfocus))))
;; Display mode-line with `variable-pitch' face
(defun doom-modeline-variable-pitch (&rest _)
(when doom-modeline-enable-variable-pitch
(dolist (face '(mode-line mode-line-inactive))
(let ((faces (face-attribute face :inherit nil)))
(set-face-attribute
face nil :inherit
`(variable-pitch ,@(delq 'unspecified (if (listp faces) faces (list faces)))))))
(with-eval-after-load 'doom-themes
(let ((faces (face-attribute 'doom-modeline-error :inherit nil)))
(set-face-attribute
'doom-modeline-error nil :inherit
`(variable-pitch ,@(delq 'unspecified (if (listp faces) faces (list faces)))))))))
(doom-modeline-variable-pitch)
(advice-add #'load-theme :after #'doom-modeline-variable-pitch)
;; ;;
;; Modeline helpers ;; Modeline helpers

View file

@ -322,7 +322,9 @@ directory, the file name, and its state (modified, read-only or non-existent)."
'face `(:height 'face `(:height
,(doom-modeline-icon-height 1.1) ,(doom-modeline-icon-height 1.1)
:family :family
,(all-the-icons-icon-family icon)))) ,(all-the-icons-icon-family icon)
:inherit
,(if active 'mode-line 'mode-line-inactive))))
(if active doom-modeline-vspc doom-modeline-inactive-vspc)))) (if active doom-modeline-vspc doom-modeline-inactive-vspc))))
;; state icon ;; state icon
@ -337,7 +339,8 @@ directory, the file name, and its state (modified, read-only or non-existent)."
`(:height `(:height
,(doom-modeline-icon-height 1.3) ,(doom-modeline-icon-height 1.3)
:family :family
,(all-the-icons-icon-family icon)) ,(all-the-icons-icon-family icon)
:inherit mode-line-inactive)
'mode-line-inactive))) 'mode-line-inactive)))
(if active doom-modeline-vspc doom-modeline-inactive-vspc))) (if active doom-modeline-vspc doom-modeline-inactive-vspc)))
@ -543,7 +546,9 @@ Uses `all-the-icons-octicon' to fetch the icon."
`(:height `(:height
,(doom-modeline-icon-height 1.2) ,(doom-modeline-icon-height 1.2)
:family :family
,(all-the-icons-icon-family icon)) ,(all-the-icons-icon-family icon)
:inherit
mode-line-inactive)
'mode-line-inactive)) 'mode-line-inactive))
doom-modeline-inactive-vspc doom-modeline-inactive-vspc
(propertize text 'face 'mode-line-inactive))) (propertize text 'face 'mode-line-inactive)))
@ -856,7 +861,9 @@ icons."
`(:height `(:height
,(doom-modeline-icon-height 1.3) ,(doom-modeline-icon-height 1.3)
:family :family
,(all-the-icons-icon-family icon)) ,(all-the-icons-icon-family icon)
:inherit
mode-line-inactive)
'mode-line-inactive))) 'mode-line-inactive)))
(when (and doom-modeline-icon icon text) doom-modeline-inactive-vspc) (when (and doom-modeline-icon icon text) doom-modeline-inactive-vspc)
(when text (propertize text 'face 'mode-line-inactive)))) (when text (propertize text 'face 'mode-line-inactive))))
@ -1528,8 +1535,8 @@ mouse-3: Fetch notifications"
(lambda () (lambda ()
"Open github notifications page." "Open github notifications page."
(interactive) (interactive)
(browse-url "https://github.com/notifications") (run-with-timer 60 nil #'doom-modeline--github-fetch-notifications)
(run-with-timer 60 nil #'doom-modeline--github-fetch-notifications))) (browse-url "https://github.com/notifications")))
(define-key map [mode-line mouse-3] (define-key map [mode-line mouse-3]
(lambda () (lambda ()
"Fetching github notifications." "Fetching github notifications."

View file

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