From a0597743c6f4d46a709bbdcd0cfe6881d35d7b5d Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 20 Apr 2021 09:39:16 +0800 Subject: 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. --- modeline.el | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'modeline.el') diff --git a/modeline.el b/modeline.el index 6def3e3..b93b833 100644 --- a/modeline.el +++ b/modeline.el @@ -21,13 +21,39 @@ ;;;###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." -- cgit v1.2.3-18-g5258