From 933f321092589ee2f844be8e2c69490c48aa42b3 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Mon, 4 Mar 2019 17:10:02 +0700 Subject: [PATCH] [Feature] Display mode-line with `variable-pitch' face. --- README.md | 14 ++++++++++++-- doom-modeline-core.el | 25 +++++++++++++++++++++++-- doom-modeline.el | 3 ++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0c8b02b..b8c7136 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ The `doom-modeline` was designed for minimalism, and offers: - An indicator for `LSP` state - An indicator for github notifications - An indicator for unread emails with `mu4e-alert` +- An indicator for irc notifications with `circe` - An indicator for buffer position which is compatible with `nyan-mode` - An indicator for party parrot - An indicator for PDF page number @@ -149,8 +150,8 @@ Strongly recommend to use ;; Please refer to https://github.com/bbatsov/projectile/issues/657. (setq doom-modeline-buffer-file-name-style 'truncate-upto-project) -;; What executable of Python will be used (if nil nothing will be showed). -(setq doom-modeline-python-executable "python") +;; 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). (setq doom-modeline-icon t) @@ -185,8 +186,17 @@ Strongly recommend to use ;; Whether display environment version or not. (setq doom-modeline-env-version t) +;; What executable of Python will be used (if nil nothing will be showed). +(setq doom-modeline-python-executable "python") + ;; Whether display mu4e notifications or not. Requires `mu4e-alert' package. (setq doom-modeline-mu4e t) + +;; Whether display irc notifications or not. Requires `circe' package. +(setq doom-modeline-irc t) + +;; Function to stylize the irc buffer names. +(setq doom-modeline-irc-stylize 'identity) ``` ## FAQ diff --git a/doom-modeline-core.el b/doom-modeline-core.el index 641fb93..0f3765b 100644 --- a/doom-modeline-core.el +++ b/doom-modeline-core.el @@ -86,8 +86,8 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el file-name => comint.el buffer-name => comint.el<2> (uniquify buffer name)") -(defvar doom-modeline-python-executable "python" - "What executable of Python will be used (if nil nothing will be showed).") +(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) "Whether show `all-the-icons' or not. @@ -126,6 +126,9 @@ The icons may not be showed correctly in terminal and on Windows.") "Whether display environment version or not.") (define-obsolete-variable-alias 'doom-modeline-version 'doom-modeline-env-version "1.7.4") +(defvar doom-modeline-python-executable "python" + "What executable of Python will be used (if nil nothing will be showed).") + (defvar doom-modeline-mu4e t "Whether display mu4e notifications or not. Requires `mu4e-alert' package.") @@ -422,6 +425,24 @@ If DEFAULT is non-nil, set the default mode-line for all buffers." (add-hook 'focus-in-hook #'doom-modeline-focus) (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 diff --git a/doom-modeline.el b/doom-modeline.el index 4bc2376..1240ff1 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -4,7 +4,7 @@ ;; Author: Vincent Zhang ;; Homepage: https://github.com/seagle0128/doom-modeline -;; Version: 1.8.0 +;; Version: 1.8.1 ;; 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 @@ -55,6 +55,7 @@ ;; - An indicator for LSP state ;; - An indicator for github notifications ;; - An indicator for unread emails with mu4e-alert +;; - An indicator for irc notifications with circe ;; - An indicator for buffer position which is compatible with nyan-mode ;; - An indicator for party parrot ;; - An indicator for PDF page number