projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0aacce1
)
Add 'Not charging' status support
author
Spenser Truex
<truex@equwal.com>
Wed, 26 Oct 2022 19:34:47 +0000
(21:34 +0200)
committer
drkhsh
<me@drkhsh.at>
Wed, 26 Oct 2022 19:34:58 +0000
(21:34 +0200)
Exists on various ThinkPads. Seems to be both a synonym for "full".
Tested on:
- ThinkPad T500 (Spenser Truex <truex@equwal.com)
- ThinkPad T420 (drkhsh <me@drkhsh.at)
components/battery.c
patch
|
blob
|
history
diff --git
a/components/battery.c
b/components/battery.c
index f2b0f147003231befb7a86653c77095f09454555..a36132d52331e03cd81adbf1c79ac303473e29fc 100644
(file)
--- a/
components/battery.c
+++ b/
components/battery.c
@@
-53,6
+53,7
@@
{ "Charging", "+" },
{ "Discharging", "-" },
{ "Full", "o" },
+ { "Not charging", "o" },
};
size_t i;
char path[PATH_MAX], state[12];
@@
-61,7
+62,7
@@
"/sys/class/power_supply/%s/status", bat) < 0) {
return NULL;
}
- if (pscanf(path, "%12
s
", state) != 1) {
+ if (pscanf(path, "%12
[a-zA-Z ]
", state) != 1) {
return NULL;
}
@@
-84,7
+85,7
@@
"/sys/class/power_supply/%s/status", bat) < 0) {
return NULL;
}
- if (pscanf(path, "%12
s
", state) != 1) {
+ if (pscanf(path, "%12
[a-zA-Z ]
", state) != 1) {
return NULL;
}