1
- ; ;; battery.el --- display battery status information
1
+ ; ;; battery.el --- display battery status information -*- lexical-binding : t -*-
2
2
3
3
; ; Copyright (C) 1997-1998, 2000-2020 Free Software Foundation, Inc.
4
4
5
5
; ; Author: Ralph Schleicher <[email protected] >
6
+
6
7
; ; Keywords: hardware
7
8
8
9
; ; This file is part of GNU Emacs.
22
23
23
24
; ;; Commentary:
24
25
25
- ; ; There is at present support for GNU/Linux, macOS and Windows. This
26
- ; ; library supports UPower (https://upower.freedesktop.org) via D-Bus
27
- ; ; API or the `/proc/apm' file format of Linux version 1.3.58 or newer
28
- ; ; and the `/proc/acpi/' directory structure of Linux 2.4.20 and 2.6.
29
- ; ; Darwin (macOS) is supported by using the `pmset' program. Windows
30
- ; ; is supported by the GetSystemPowerStatus API call.
26
+ ; ; There is at present support for GNU/Linux, macOS, and Windows.
27
+ ; ; This library supports:
28
+ ; ; - UPower (https://upower.freedesktop.org) via D-Bus API.
29
+ ; ; - the `/sys/class/power_supply/' files of Linux >= 2.6.39.
30
+ ; ; - the `/proc/acpi/' directory structure of Linux 2.4.20 and 2.6.
31
+ ; ; - the `/proc/apm' file format of Linux version 1.3.58 or newer.
32
+ ; ; - Darwin (macOS) by using the `pmset' program.
33
+ ; ; - Windows via the GetSystemPowerStatus API call.
31
34
32
35
; ;; Code:
33
36
45
48
Use `battery-upower-device-list' to list all available UPower devices.
46
49
If set to nil, then autodetect `:battery' device."
47
50
:version " 28.1"
48
- :type '(choice string (const :tag " Autodetect" nil ))
49
- :group 'battery )
51
+ :type '(choice string (const :tag " Autodetect" nil )))
50
52
51
53
(defcustom battery-upower-line-power-device nil
52
54
" UPower device of the `:line-power' type.
53
55
Use `battery-upower-device-list' to list all available UPower devices.
54
56
If set to nil, then autodetect `:battery' device."
55
57
:version " 28.1"
56
- :type '(choice string (const :tag " Autodetect" nil ))
57
- :group 'battery )
58
+ :type '(choice string (const :tag " Autodetect" nil )))
58
59
59
60
(defconst battery-upower-dbus-service " org.freedesktop.UPower"
60
61
" Well-known UPower service name for the D-Bus system." )
@@ -101,8 +102,7 @@ Its cons cells are of the form
101
102
102
103
CONVERSION is the character code of a \" conversion specification\"
103
104
introduced by a `%' character in a control string."
104
- :type '(choice (const nil ) function)
105
- :group 'battery )
105
+ :type '(choice (const nil ) function))
106
106
107
107
(defcustom battery-echo-area-format
108
108
" Power %L, battery %B (%p%% load, remaining time %t)"
@@ -122,8 +122,7 @@ string are substituted as defined by the current value of the variable
122
122
%m Remaining time (to charge or discharge) in minutes
123
123
%h Remaining time (to charge or discharge) in hours
124
124
%t Remaining time (to charge or discharge) in the form `h:min' "
125
- :type '(choice string (const nil ))
126
- :group 'battery )
125
+ :type '(choice string (const nil )))
127
126
128
127
(defvar battery-mode-line-string nil
129
128
" String to display in the mode line." )
@@ -132,8 +131,7 @@ string are substituted as defined by the current value of the variable
132
131
(defcustom battery-mode-line-limit 100
133
132
" Percentage of full battery load below which display battery status."
134
133
:version " 24.1"
135
- :type 'integer
136
- :group 'battery )
134
+ :type 'integer )
137
135
138
136
(defcustom battery-mode-line-format
139
137
(cond ((eq battery-status-function 'battery-linux-proc-acpi )
@@ -156,25 +154,21 @@ string are substituted as defined by the current value of the variable
156
154
%m Remaining time (to charge or discharge) in minutes
157
155
%h Remaining time (to charge or discharge) in hours
158
156
%t Remaining time (to charge or discharge) in the form `h:min' "
159
- :type '(choice string (const nil ))
160
- :group 'battery )
157
+ :type '(choice string (const nil )))
161
158
162
159
(defcustom battery-update-interval 60
163
160
" Seconds after which the battery status will be updated."
164
- :type 'integer
165
- :group 'battery )
161
+ :type 'integer )
166
162
167
163
(defcustom battery-load-low 25
168
164
" Upper bound of low battery load percentage.
169
165
A battery load percentage below this number is considered low."
170
- :type 'integer
171
- :group 'battery )
166
+ :type 'integer )
172
167
173
168
(defcustom battery-load-critical 10
174
169
" Upper bound of critical battery load percentage.
175
170
A battery load percentage below this number is considered critical."
176
- :type 'integer
177
- :group 'battery )
171
+ :type 'integer )
178
172
179
173
(defvar battery-update-timer nil
180
174
" Interval timer object." )
@@ -198,7 +192,7 @@ The text displayed in the mode line is controlled by
198
192
`battery-mode-line-format' and `battery-status-function' .
199
193
The mode line is be updated every `battery-update-interval'
200
194
seconds."
201
- :global t :group 'battery
195
+ :global t
202
196
(setq battery-mode-line-string " " )
203
197
(or global-mode-string (setq global-mode-string '(" " )))
204
198
(and battery-update-timer (cancel-timer battery-update-timer))
0 commit comments