Enable colored output for battery on FreeBSD
Patch status: merged
Patch by Baptiste Daroussin
To apply this patch, use:
curl http://cr.i3wm.org/patch/95/raw.patch | git am
b/src/print_battery_info.c
13 |
@@ -234,6 +234,15 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char |
14 |
minutes -= (hours * 60); |
15 |
(void)snprintf(remainingbuf, sizeof(remainingbuf), "%02dh%02d", |
16 |
max(hours, 0), max(minutes, 0)); |
17 |
+ if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0 |
18 |
+ && present_rate < low_threshold) { |
19 |
+ START_COLOR("color_bad"); |
20 |
+ colorful_output = true; |
21 |
+ } else if (strncmp(threshold_type, "time", strlen(threshold_type)) == 0 |
22 |
+ && remaining < (u_int) low_threshold) { |
23 |
+ START_COLOR("color_bad"); |
24 |
+ colorful_output = true; |
25 |
+ } |
26 |
} |
27 |
#elif defined(__OpenBSD__) |
28 |
/* |