mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
Calculate the actual char height of the mode-line.
doom-modeline-height is the minimal height of mode-line. It respects the actual char height.
This commit is contained in:
parent
d306c3f0d3
commit
825c2bed71
3 changed files with 17 additions and 10 deletions
|
@ -134,10 +134,11 @@ Strongly recommend to use
|
|||
## Customize
|
||||
|
||||
``` emacs-lisp
|
||||
;; How tall the mode-line should be (only respected in GUI Emacs).
|
||||
;; How tall the mode-line should be. It's only respected in GUI.
|
||||
;; If the actual char height is larger, it respects the actual height.
|
||||
(setq doom-modeline-height 25)
|
||||
|
||||
;; How wide the mode-line bar should be (only respected in GUI Emacs).
|
||||
;; How wide the mode-line bar should be. It's only respected in GUI.
|
||||
(setq doom-modeline-bar-width 3)
|
||||
|
||||
;; Determines the style used by `doom-modeline-buffer-file-name'.
|
||||
|
|
|
@ -131,14 +131,12 @@ It returns a file name which can be used directly as argument of
|
|||
;; Variables
|
||||
;;
|
||||
|
||||
(defvar doom-modeline-height (let ((font (face-font 'mode-line)))
|
||||
(if (and font (fboundp 'font-info))
|
||||
(* 2 (aref (font-info font) 2))
|
||||
25))
|
||||
"How tall the mode-line should be (only respected in GUI Emacs).")
|
||||
(defvar doom-modeline-height 25
|
||||
"How tall the mode-line should be. It's only respected in GUI.
|
||||
If the actual char height is larger, it respects the actual char height.")
|
||||
|
||||
(defvar doom-modeline-bar-width (if (eq system-type 'darwin) 3 6)
|
||||
"How wide the mode-line bar should be (only respected in GUI Emacs).")
|
||||
"How wide the mode-line bar should be. It's only respected in GUI.")
|
||||
|
||||
(defvar doom-modeline-buffer-file-name-style 'truncate-upto-project
|
||||
"Determines the style used by `doom-modeline-buffer-file-name'.
|
||||
|
@ -488,6 +486,14 @@ It returns a file name which can be used directly as argument of
|
|||
"Whether is an active window."
|
||||
(eq (selected-window) doom-modeline-current-window))
|
||||
|
||||
(defun doom-modeline--char-height ()
|
||||
"Calculate the actual char height of the mode-line."
|
||||
(or
|
||||
(let ((font (face-font 'mode-line)))
|
||||
(when (and font (fboundp 'font-info))
|
||||
(* 2 (aref (font-info font) 2))))
|
||||
(round (* 1.3 (frame-char-height)))))
|
||||
|
||||
(defsubst doom-modeline-vspc ()
|
||||
"Text style with icons in mode-line."
|
||||
(propertize " " 'face (if (doom-modeline--active)
|
||||
|
|
|
@ -1226,12 +1226,12 @@ Returns \"\" to not break --no-window-system."
|
|||
(doom-modeline--make-xpm 'doom-modeline-bar
|
||||
(or width doom-modeline-bar-width)
|
||||
(max (or height doom-modeline-height)
|
||||
(ceiling (* 1.3 (frame-char-height)))))
|
||||
(doom-modeline--char-height)))
|
||||
doom-modeline--bar-inactive
|
||||
(doom-modeline--make-xpm 'doom-modeline-inactive-bar
|
||||
(or width doom-modeline-bar-width)
|
||||
(max (or height doom-modeline-height)
|
||||
(ceiling (* 1.3 (frame-char-height)))))))
|
||||
(doom-modeline--char-height)))))
|
||||
|
||||
(when (>= emacs-major-version 26)
|
||||
(add-variable-watcher
|
||||
|
|
Loading…
Reference in a new issue