Improve (hopefully) check for battery before displaying in modeline

This commit is contained in:
Evie Litherland-Smith 2024-02-29 16:15:09 +00:00
parent 3a70aa9cd9
commit 3a9f4294cf

View file

@ -231,9 +231,12 @@ Removed in favour of [[https://github.com/catppuccin/emacs][Catppuccin (emacs)]]
#+end_src
** Battery state for laptops
#+begin_src emacs-lisp
(with-eval-after-load 'battery
(when (battery-upower)
(display-battery-mode +1)))
(require 'battery)
(when (and battery-status-function
(not ( string-match-p "unknown"
( battery-format "%B"
(funcall battery-status-function)))))
(display-battery-mode +1))
#+end_src
* Dashboard
#+begin_src emacs-lisp