From: Baptiste Daroussin Date: Tue, 19 Mar 2013 18:23:01 +0000 (+0100) Subject: Enable colored output for battery on FreeBSD X-Git-Tag: 2.8~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8dbadb6d4ec424f782475f6f014e148ebae6d028;p=i3%2Fi3status Enable colored output for battery on FreeBSD --- diff --git a/src/print_battery_info.c b/src/print_battery_info.c index c9eee23..3fc31e0 100644 --- a/src/print_battery_info.c +++ b/src/print_battery_info.c @@ -234,6 +234,15 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char minutes -= (hours * 60); (void)snprintf(remainingbuf, sizeof(remainingbuf), "%02dh%02d", max(hours, 0), max(minutes, 0)); + if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0 + && present_rate < low_threshold) { + START_COLOR("color_bad"); + colorful_output = true; + } else if (strncmp(threshold_type, "time", strlen(threshold_type)) == 0 + && remaining < (u_int) low_threshold) { + START_COLOR("color_bad"); + colorful_output = true; + } } #elif defined(__OpenBSD__) /*