X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=i3status.c;h=5d3153cea5c97731ba5f61436e34ee0ec1df21db;hb=35f3bcb348cdbc43060a23c2116259bb74c981a1;hp=de63bc17f48029dde8d38ab220e6614c48fb2915;hpb=1b3aa404858b476015a2b29d0c42f7dbbed915bc;p=i3%2Fi3status diff --git a/i3status.c b/i3status.c index de63bc1..5d3153c 100644 --- a/i3status.c +++ b/i3status.c @@ -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 * Copyright © 2010 Axel Wagner * Copyright © 2010 Fernando Tarlá Cardoso Lemos @@ -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,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", 30, CFGF_NONE), + CFG_STR("threshold_type", "time", CFGF_NONE), CFG_BOOL("last_full_capacity", false, CFGF_NONE), CFG_END() }; @@ -241,6 +243,7 @@ int main(int argc, char *argv[]) { cfg_opt_t temp_opts[] = { CFG_STR("format", "%degrees C", CFGF_NONE), CFG_STR("path", NULL, CFGF_NONE), + CFG_INT("max_threshold", 75, CFGF_NONE), CFG_END() }; @@ -296,11 +299,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 ] [-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 +416,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_getstr(sec, "threshold_type"), cfg_getbool(sec, "last_full_capacity")); SEC_CLOSE_MAP; } @@ -458,7 +461,7 @@ int main(int argc, char *argv[]) { CASE_SEC_TITLE("cpu_temperature") { SEC_OPEN_MAP("cpu_temperature"); - print_cpu_temperature_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format")); + print_cpu_temperature_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getint(sec, "max_threshold")); SEC_CLOSE_MAP; }