mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 11:09:54 +00:00
Optimize: faster to render icons.
This commit is contained in:
parent
1834cf687d
commit
7c318f0708
1 changed files with 36 additions and 36 deletions
|
@ -193,23 +193,16 @@
|
||||||
(doom-modeline-def-segment buffer-default-directory
|
(doom-modeline-def-segment buffer-default-directory
|
||||||
"Displays `default-directory'. This is for special buffers like the scratch
|
"Displays `default-directory'. This is for special buffers like the scratch
|
||||||
buffer where knowing the current project directory is important."
|
buffer where knowing the current project directory is important."
|
||||||
(let ((active (doom-modeline--active))
|
(let* ((active (doom-modeline--active))
|
||||||
(icon (doom-modeline-icon-octicon "file-directory"
|
(face (if active 'doom-modeline-buffer-path 'mode-line-inactive)))
|
||||||
:face 'doom-modeline-buffer-path
|
|
||||||
:v-adjust -0.05
|
|
||||||
:height 1.25)))
|
|
||||||
(concat (doom-modeline-spc)
|
(concat (doom-modeline-spc)
|
||||||
(when doom-modeline-icon
|
(doom-modeline-icon-octicon "file-directory"
|
||||||
(concat
|
:face face
|
||||||
(if active
|
:v-adjust -0.05
|
||||||
icon
|
:height 1.25)
|
||||||
(propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
|
(when doom-modeline-icon (doom-modeline-spc))
|
||||||
:inherit mode-line-inactive)))
|
|
||||||
(doom-modeline-spc)))
|
|
||||||
(propertize (abbreviate-file-name default-directory)
|
(propertize (abbreviate-file-name default-directory)
|
||||||
'face (if active
|
'face face))))
|
||||||
'doom-modeline-buffer-path
|
|
||||||
'mode-line-inactive)))))
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(defvar-local doom-modeline--buffer-file-icon nil)
|
(defvar-local doom-modeline--buffer-file-icon nil)
|
||||||
|
@ -2079,27 +2072,40 @@ we don't want to remove that so we just return the original."
|
||||||
(icon (cond
|
(icon (cond
|
||||||
(charging?
|
(charging?
|
||||||
(if doom-modeline-icon
|
(if doom-modeline-icon
|
||||||
(doom-modeline-icon-alltheicon "battery-charging" :height 1.4 :v-adjust -0.1)
|
(doom-modeline-icon-alltheicon "battery-charging"
|
||||||
|
:face face
|
||||||
|
:height 1.4
|
||||||
|
:v-adjust -0.1)
|
||||||
"+"))
|
"+"))
|
||||||
((> percentage-number 95)
|
((> percentage-number 95)
|
||||||
(if doom-modeline-icon
|
(if doom-modeline-icon
|
||||||
(doom-modeline-icon-faicon "battery-full" :v-adjust -0.0575)
|
(doom-modeline-icon-faicon "battery-full"
|
||||||
|
:face face
|
||||||
|
:v-adjust -0.0575)
|
||||||
"-"))
|
"-"))
|
||||||
((> percentage-number 70)
|
((> percentage-number 70)
|
||||||
(if doom-modeline-icon
|
(if doom-modeline-icon
|
||||||
(doom-modeline-icon-faicon "battery-three-quarters" :v-adjust -0.0575)
|
(doom-modeline-icon-faicon "battery-three-quarters"
|
||||||
|
:face face
|
||||||
|
:v-adjust -0.0575)
|
||||||
"-"))
|
"-"))
|
||||||
((> percentage-number 40)
|
((> percentage-number 40)
|
||||||
(if doom-modeline-icon
|
(if doom-modeline-icon
|
||||||
(doom-modeline-icon-faicon "battery-half" :v-adjust -0.0575)
|
(doom-modeline-icon-faicon "battery-half"
|
||||||
|
:face face
|
||||||
|
:v-adjust -0.0575)
|
||||||
"-"))
|
"-"))
|
||||||
((> percentage-number 15)
|
((> percentage-number 15)
|
||||||
(if doom-modeline-icon
|
(if doom-modeline-icon
|
||||||
(doom-modeline-icon-faicon "battery-quarter" :v-adjust -0.0575)
|
(doom-modeline-icon-faicon "battery-quarter"
|
||||||
|
:face face
|
||||||
|
:v-adjust -0.0575)
|
||||||
"-"))
|
"-"))
|
||||||
(t
|
(t
|
||||||
(if doom-modeline-icon
|
(if doom-modeline-icon
|
||||||
(doom-modeline-icon-faicon "battery-empty" :v-adjust -0.0575)
|
(doom-modeline-icon-faicon "battery-empty"
|
||||||
|
:face face
|
||||||
|
:v-adjust -0.0575)
|
||||||
"!"))))
|
"!"))))
|
||||||
(percent-str (and percentage (concat percentage "%%")))
|
(percent-str (and percentage (concat percentage "%%")))
|
||||||
(help-echo (if battery-echo-area-format
|
(help-echo (if battery-echo-area-format
|
||||||
|
@ -2109,13 +2115,9 @@ we don't want to remove that so we just return the original."
|
||||||
(doom-modeline-spc)
|
(doom-modeline-spc)
|
||||||
(if percent-str
|
(if percent-str
|
||||||
(concat
|
(concat
|
||||||
(propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
|
(propertize icon 'help-echo help-echo)
|
||||||
:inherit ,face)
|
|
||||||
'help-echo help-echo)
|
|
||||||
(if doom-modeline-icon (doom-modeline-vspc))
|
(if doom-modeline-icon (doom-modeline-vspc))
|
||||||
(propertize percent-str
|
(propertize percent-str 'face face 'help-echo help-echo))
|
||||||
'face face
|
|
||||||
'help-echo help-echo))
|
|
||||||
;; Battery status is not available
|
;; Battery status is not available
|
||||||
(if doom-modeline-icon
|
(if doom-modeline-icon
|
||||||
(doom-modeline-icon-faicon "battery-empty" :v-adjust -0.0575 :face 'error)
|
(doom-modeline-icon-faicon "battery-empty" :v-adjust -0.0575 :face 'error)
|
||||||
|
@ -2155,15 +2157,13 @@ we don't want to remove that so we just return the original."
|
||||||
|
|
||||||
(when (and doom-modeline-icon doom-modeline-major-mode-icon)
|
(when (and doom-modeline-icon doom-modeline-major-mode-icon)
|
||||||
(concat (doom-modeline-spc)
|
(concat (doom-modeline-spc)
|
||||||
(let ((icon (doom-modeline-icon-for-mode 'paradox-menu-mode :v-adjust -0.15)))
|
(doom-modeline-icon-for-mode
|
||||||
(if active
|
'paradox-menu-mode
|
||||||
icon
|
:v-adjust -0.15
|
||||||
(propertize icon 'face `(:inherit
|
:face (if active
|
||||||
,(let ((props (get-text-property 0 'face icon)))
|
(unless doom-modeline-major-mode-color-icon
|
||||||
(if doom-modeline-major-mode-color-icon
|
'mode-line)
|
||||||
props
|
'mode-line-inactive))))
|
||||||
(remove :inherit props)))
|
|
||||||
:inherit mode-line-inactive))))))
|
|
||||||
(let ((info (format-mode-line 'mode-line-buffer-identification)))
|
(let ((info (format-mode-line 'mode-line-buffer-identification)))
|
||||||
(if active
|
(if active
|
||||||
info
|
info
|
||||||
|
|
Loading…
Reference in a new issue