summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorTommie Gannert <tommie@gannert.se>2016-08-01 18:03:03 +0100
committerTommie Gannert <tommie@gannert.se>2016-08-28 14:29:08 +0100
commitdc072f9f5353dc8adab14b2de99f0c1abb25e8d8 (patch)
treec49efb14c7983dad7fa215d6d96d6edd56f9b30f /i3status.c
parentac8998ef03374abca56da9929812c6fcba936031 (diff)
Implement aggregates for batteries.
Using title number all, this enables aggregates. Note that FreeBSD and OpenBSD previously only reported aggregates, so this is bringing Linux and NetBSD that functionality. Changes the default battery reporting to the aggregate since most users probably don't care about individual batteries. For single-battery systems there should be no change. Fixes one obvious memory leak in NetBSD.
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/i3status.c b/i3status.c
index 892d4aa..5e17745 100644
--- a/i3status.c
+++ b/i3status.c
@@ -664,7 +664,7 @@ int main(int argc, char *argv[]) {
CASE_SEC_TITLE("battery") {
SEC_OPEN_MAP("battery");
- print_battery_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getstr(sec, "format_down"), cfg_getstr(sec, "status_chr"), cfg_getstr(sec, "status_bat"), cfg_getstr(sec, "status_unk"), cfg_getstr(sec, "status_full"), cfg_getint(sec, "low_threshold"), cfg_getstr(sec, "threshold_type"), cfg_getbool(sec, "last_full_capacity"), cfg_getbool(sec, "integer_battery_capacity"), cfg_getbool(sec, "hide_seconds"));
+ print_battery_info(json_gen, buffer, (strcasecmp(title, "all") == 0 ? -1 : atoi(title)), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getstr(sec, "format_down"), cfg_getstr(sec, "status_chr"), cfg_getstr(sec, "status_bat"), cfg_getstr(sec, "status_unk"), cfg_getstr(sec, "status_full"), cfg_getint(sec, "low_threshold"), cfg_getstr(sec, "threshold_type"), cfg_getbool(sec, "last_full_capacity"), cfg_getbool(sec, "integer_battery_capacity"), cfg_getbool(sec, "hide_seconds"));
SEC_CLOSE_MAP;
}