diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2013-03-19 19:23:01 +0100 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2013-03-19 19:54:15 +0100 |
commit | 8dbadb6d4ec424f782475f6f014e148ebae6d028 (patch) | |
tree | af30efca58cad43b64d3659fc85cdad7b433d763 | |
parent | f30ec89b79143d5d90f7fbe9c5aaf73ef6847e30 (diff) |
Enable colored output for battery on FreeBSD
-rw-r--r-- | src/print_battery_info.c | 9 |
1 files changed, 9 insertions, 0 deletions
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__) /* |