summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-04-20 09:39:16 +0800
committerJSDurand <mmemmew@gmail.com>2021-04-20 09:39:16 +0800
commita0597743c6f4d46a709bbdcd0cfe6881d35d7b5d (patch)
tree0a8a808dd970a63934d0496293b7458717c62508
parenta8fed34329cfb2f3095c300d1e910008d7a7b2b1 (diff)
Also display time and battery in the dashboard
* modeline.el (modeline-format-dashboard): We need a right part to display time and battery. (modeline-dashboard-format-right): The original part (modeline-dashboard-format-left): The time and the battery are displayed here.
-rw-r--r--modeline.el28
1 files changed, 27 insertions, 1 deletions
diff --git a/modeline.el b/modeline.el
index 6def3e3..b93b833 100644
--- a/modeline.el
+++ b/modeline.el
@@ -21,14 +21,40 @@
;;;###autoload
(defun modeline-format-dashboard ()
"The mode line format for the dashboard."
+ (let* ((left (modeline-dashboard-format-left))
+ (right (modeline-dashboard-format-right))
+ (left-len (length left))
+ (right-len (length right))
+ (middle (propertize " " 'display
+ (make-string
+ (max (- (window-total-width)
+ left-len
+ right-len)
+ 0)
+ 32))))
+ (concat left middle right)))
+
+;;;###autoload
+(defun modeline-dashboard-format-left ()
+ "The left / main part of the mode line for the dashboard."
(concat
- ;; (modeline-format-bar)
(modeline-spc)
(modeline-format-directory)
(modeline-spc)
(modeline-format-minor-modes)))
;;;###autoload
+(defun modeline-dashboard-format-right ()
+ "The right part of the mode line for the dashboard."
+ (declare (side-effect-free t) (pure t))
+ (let ((face (cond ((modeline-active-window-p) 'doom-modeline-buffer-major-mode)
+ ('mode-line-inactive))))
+ (concat
+ (modeline-propertize
+ (format-mode-line global-mode-string face))
+ (modeline-spc))))
+
+;;;###autoload
(defun modeline-format-left ()
"The left mode line format."
(concat