Enable colored output for battery on FreeBSD

This commit is contained in:
Baptiste Daroussin 2013-03-19 19:23:01 +01:00 committed by Michael Stapelberg
parent f30ec89b79
commit 8dbadb6d4e

View File

@ -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__)
/*