Battery

From WikEmacs
Revision as of 07:01, 5 April 2012 by Kindahero (talk | contribs) (customization)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Battery.el
Description Shows the battery status in the mode line
Author Ralph Schleicher
Maintainer FSF
Source http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/battery.el
Part of Emacs yes

Basic setup

M-x display-battery-mode
Add your battery status to the Modeline
M-x battery
View battery status

Customization

Gnu/Linux

How to show battery status only on laptop?

if a device have no battery, we don't want to display-battery-mode be enabled.<ref>http://stackoverflow.com/questions/5562974/emacs-is-it-running-on-laptop-or-on-desktop</ref>

(require 'battery)
(when (and battery-status-function
           (not (string-match-p "N/A"
                                (battery-format "%B"
                                                (funcall battery-status-function)))))
  (display-battery-mode 1))

See Also

time