Difference between revisions of "Battery"

From WikEmacs
Jump to: navigation, search
m (customization)
m
 
Line 20: Line 20:
 
===Gnu/Linux ===
 
===Gnu/Linux ===
 
==== How to show battery status only on laptop? ====
 
==== How to show battery status only on laptop? ====
if a device have no battery, we don't want to '''display-battery-mode''' be
+
if a device has 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>
 
enabled.<ref>http://stackoverflow.com/questions/5562974/emacs-is-it-running-on-laptop-or-on-desktop</ref>
  

Latest revision as of 02:02, 5 April 2012

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[edit]

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

Customization[edit]

Gnu/Linux[edit]

How to show battery status only on laptop?[edit]

if a device has no battery, we don't want to display-battery-mode be enabled.[1]

(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[edit]

time
Cite error: <ref> tags exist, but no <references/> tag was found