summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/print_battery_info.c9
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__)
/*