From 3a9f4294cf759529ed33793bc2f91201781a54f9 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Thu, 29 Feb 2024 16:15:09 +0000 Subject: [PATCH] Improve (hopefully) check for battery before displaying in modeline --- config/ui.org | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config/ui.org b/config/ui.org index ec2860c..07dd0ea 100644 --- a/config/ui.org +++ b/config/ui.org @@ -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