Highlight the battery level when below 20%.
authorFrancois Fleuret <francois@fleuret.org>
Wed, 23 Jan 2013 13:32:11 +0000 (14:32 +0100)
committerFrancois Fleuret <francois@fleuret.org>
Wed, 23 Jan 2013 13:32:11 +0000 (14:32 +0100)
emacs.el

index f871271..525a118 100644 (file)
--- a/emacs.el
+++ b/emacs.el
@@ -830,8 +830,10 @@ printer."
                                 (ff/battery-percent "energy"))))
 
           ((string= battery-status "Discharging")
-           (format "B%d%%"  (max (ff/battery-percent "charge")
-                                 (ff/battery-percent "energy"))))
+           (let* ((c (max (ff/battery-percent "charge")
+                          (ff/battery-percent "energy")))
+                  (s (format "B%d%%" c)))
+             (if (>= c 20) s (propertize s 'face 'font-lock-warning-face))))
 
           (t battery-status)