mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 11:09:52 +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
|
## Customize
|
||||||
|
|
||||||
``` emacs-lisp
|
``` 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)
|
(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)
|
(setq doom-modeline-bar-width 3)
|
||||||
|
|
||||||
;; Determines the style used by `doom-modeline-buffer-file-name'.
|
;; 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
|
;; Variables
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defvar doom-modeline-height (let ((font (face-font 'mode-line)))
|
(defvar doom-modeline-height 25
|
||||||
(if (and font (fboundp 'font-info))
|
"How tall the mode-line should be. It's only respected in GUI.
|
||||||
(* 2 (aref (font-info font) 2))
|
If the actual char height is larger, it respects the actual char height.")
|
||||||
25))
|
|
||||||
"How tall the mode-line should be (only respected in GUI Emacs).")
|
|
||||||
|
|
||||||
(defvar doom-modeline-bar-width (if (eq system-type 'darwin) 3 6)
|
(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
|
(defvar doom-modeline-buffer-file-name-style 'truncate-upto-project
|
||||||
"Determines the style used by `doom-modeline-buffer-file-name'.
|
"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."
|
"Whether is an active window."
|
||||||
(eq (selected-window) doom-modeline-current-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 ()
|
(defsubst doom-modeline-vspc ()
|
||||||
"Text style with icons in mode-line."
|
"Text style with icons in mode-line."
|
||||||
(propertize " " 'face (if (doom-modeline--active)
|
(propertize " " 'face (if (doom-modeline--active)
|
||||||
|
|
|
@ -1226,12 +1226,12 @@ Returns \"\" to not break --no-window-system."
|
||||||
(doom-modeline--make-xpm 'doom-modeline-bar
|
(doom-modeline--make-xpm 'doom-modeline-bar
|
||||||
(or width doom-modeline-bar-width)
|
(or width doom-modeline-bar-width)
|
||||||
(max (or height doom-modeline-height)
|
(max (or height doom-modeline-height)
|
||||||
(ceiling (* 1.3 (frame-char-height)))))
|
(doom-modeline--char-height)))
|
||||||
doom-modeline--bar-inactive
|
doom-modeline--bar-inactive
|
||||||
(doom-modeline--make-xpm 'doom-modeline-inactive-bar
|
(doom-modeline--make-xpm 'doom-modeline-inactive-bar
|
||||||
(or width doom-modeline-bar-width)
|
(or width doom-modeline-bar-width)
|
||||||
(max (or height doom-modeline-height)
|
(max (or height doom-modeline-height)
|
||||||
(ceiling (* 1.3 (frame-char-height)))))))
|
(doom-modeline--char-height)))))
|
||||||
|
|
||||||
(when (>= emacs-major-version 26)
|
(when (>= emacs-major-version 26)
|
||||||
(add-variable-watcher
|
(add-variable-watcher
|
||||||
|
|
Loading…
Reference in a new issue