ui/doom-modeline: adjust bars when height/width is changed
Also when doom-big-font-mode is toggled.
This commit is contained in:
parent
e6c7c8a8cd
commit
85e5ac4514
2 changed files with 37 additions and 19 deletions
|
@ -1,17 +1,16 @@
|
|||
;;; ui/doom-modeline/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +doom-modeline--old-height nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun +doom-modeline|resize-for-big-font ()
|
||||
"Adjust the modeline's height when `doom-big-font-mode' is enabled. This was
|
||||
made to be added to `doom-big-font-mode-hook'."
|
||||
(if doom-big-font-mode
|
||||
(let* ((font-size (font-get doom-font :size))
|
||||
(big-size (font-get doom-big-font :size))
|
||||
(ratio (/ (float big-size) font-size)))
|
||||
(setq +doom-modeline--old-height +doom-modeline-height
|
||||
+doom-modeline-height (ceiling (* +doom-modeline--old-height ratio))))
|
||||
(setq +doom-modeline-height +doom-modeline--old-height))
|
||||
(+doom-modeline|init))
|
||||
(let ((default-height (default-value '+doom-modeline-height)))
|
||||
(if doom-big-font-mode
|
||||
(let* ((font-size (font-get doom-font :size))
|
||||
(big-size (font-get doom-big-font :size))
|
||||
(ratio (/ (float big-size) font-size)))
|
||||
(setq +doom-modeline-height (ceiling (* default-height ratio))))
|
||||
(setq +doom-modeline-height default-height))
|
||||
;; already has a variable watcher in Emacs 26+
|
||||
(unless EMACS26+ (+doom-modeline|refresh-bars))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue