From: Michael Stapelberg Date: Tue, 16 Oct 2012 08:52:57 +0000 (+0200) Subject: implement max_threshold for linux, too X-Git-Tag: 2.7~28 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=450424f97a9d02e5392ce331902c95d0fa0e82ec;p=i3%2Fi3status implement max_threshold for linux, too --- diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c index 034a079..e3340f6 100644 --- a/src/print_cpu_temperature.c +++ b/src/print_cpu_temperature.c @@ -63,8 +63,15 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const temp = strtol(buf, NULL, 10); if (temp == LONG_MIN || temp == LONG_MAX || temp <= 0) *(outwalk++) = '?'; - else + else { + if ((temp/1000) >= max_threshold) { + START_COLOR("color_bad"); + colorful_output = true; + } outwalk += sprintf(outwalk, "%ld", (temp/1000)); + if (colorful_output) + END_COLOR; + } #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int sysctl_rslt; size_t sysctl_size = sizeof(sysctl_rslt);