]> git.sur5r.net Git - i3/i3status/commitdiff
implement max_threshold for linux, too
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 16 Oct 2012 08:52:57 +0000 (10:52 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 16 Oct 2012 08:52:57 +0000 (10:52 +0200)
src/print_cpu_temperature.c

index 034a079db0c506d7b4690ea70cac71c5dfd5f5e8..e3340f6e66c1c8f775c11b8ab435ca87855a83ab 100644 (file)
@@ -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);