summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorSimon Elsbrock <simon@iodev.org>2012-08-23 16:42:38 +0200
committerMichael Stapelberg <michael@stapelberg.de>2012-08-28 18:05:11 +0200
commit68f438ec9eefbca5d735a1a7897d52e0e8e6f1c7 (patch)
tree47b3009417de351625131bc3525154acf8c70fcf /i3status.c
parent3baf27bf1d9b51fa8de3203a64993de2464ed356 (diff)
add additional battery threshold type "percentage"
The battery threshold can now be configured as type "time" or "percentage", but defaults to "time" to prevent unexpected behavior. Also, low_threshold was set to a more reasonable default of 30.
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/i3status.c b/i3status.c
index f0767a0..915cbcc 100644
--- a/i3status.c
+++ b/i3status.c
@@ -214,7 +214,8 @@ int main(int argc, char *argv[]) {
cfg_opt_t battery_opts[] = {
CFG_STR("format", "%status %percentage %remaining", CFGF_NONE),
CFG_STR("path", "/sys/class/power_supply/BAT%d/uevent", CFGF_NONE),
- CFG_INT("low_threshold", 10, CFGF_NONE),
+ CFG_INT("low_threshold", 30, CFGF_NONE),
+ CFG_STR("threshold_type", "time", CFGF_NONE),
CFG_BOOL("last_full_capacity", false, CFGF_NONE),
CFG_END()
};
@@ -414,7 +415,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_getint(sec, "low_threshold"), cfg_getbool(sec, "last_full_capacity"));
+ print_battery_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getint(sec, "low_threshold"), cfg_getstr(sec, "threshold_type"), cfg_getbool(sec, "last_full_capacity"));
SEC_CLOSE_MAP;
}