]> git.sur5r.net Git - i3/i3status/blobdiff - i3status.c
rename threshold to low_threshold and document it properly
[i3/i3status] / i3status.c
index de63bc17f48029dde8d38ab220e6614c48fb2915..f0767a0555ac959a0f8257b713f0c9dc92584d42 100644 (file)
@@ -3,7 +3,7 @@
  *
  * i3status – Generates a status line for dzen2 or xmobar
  *
- * Copyright © 2008-2011 Michael Stapelberg and contributors
+ * Copyright © 2008-2012 Michael Stapelberg and contributors
  * Copyright © 2009 Thorsten Toepper <atsutane at freethoughts dot de>
  * Copyright © 2010 Axel Wagner <mail at merovius dot de>
  * Copyright © 2010 Fernando Tarlá Cardoso Lemos <fernandotcl at gmail dot com>
@@ -121,7 +121,7 @@ static char *resolve_tilde(const char *path) {
         return result;
 }
 
-static char *get_config_path() {
+static char *get_config_path(void) {
         char *xdg_config_home, *xdg_config_dirs, *config_path;
 
         /* 1: check the traditional path under the home directory */
@@ -214,6 +214,7 @@ 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_BOOL("last_full_capacity", false, CFGF_NONE),
                 CFG_END()
         };
@@ -296,11 +297,11 @@ int main(int argc, char *argv[]) {
                 if ((char)o == 'c')
                         configfile = optarg;
                 else if ((char)o == 'h') {
-                        printf("i3status " VERSION " © 2008-2011 Michael Stapelberg and contributors\n"
+                        printf("i3status " VERSION " © 2008-2012 Michael Stapelberg and contributors\n"
                                 "Syntax: %s [-c <configfile>] [-h] [-v]\n", argv[0]);
                         return 0;
                 } else if ((char)o == 'v') {
-                        printf("i3status " VERSION " © 2008-2011 Michael Stapelberg and contributors\n");
+                        printf("i3status " VERSION " © 2008-2012 Michael Stapelberg and contributors\n");
                         return 0;
                 }
 
@@ -413,7 +414,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_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_getbool(sec, "last_full_capacity"));
                                 SEC_CLOSE_MAP;
                         }