]> git.sur5r.net Git - i3/i3status/commitdiff
Use "color_degraded" when interface has no IP 50/head
authorDmitrij D. Czarkoff <czarkoff@gmail.com>
Thu, 6 Aug 2015 15:14:38 +0000 (17:14 +0200)
committerDmitrij D. Czarkoff <czarkoff@gmail.com>
Thu, 6 Aug 2015 15:20:29 +0000 (17:20 +0200)
On laptops one may want to have all interfaces up in order to let network
prioritization manage switching between wired and wireless connection.  In such
cases lack of IP address is a useful hint about currently used interface, and
color-coding makes it stand out more.

src/print_eth_info.c
src/print_wireless_info.c

index 06a1613d62d418092b267786c687c127830c7762..e2326b58e5f44416d19511005d0fb12a1cfef931 100644 (file)
@@ -126,7 +126,10 @@ void print_eth_info(yajl_gen json_gen, char *buffer, const char *interface, cons
         goto out;
     }
 
-    START_COLOR("color_good");
+    if (BEGINS_WITH(ip_address, "no IP"))
+        START_COLOR("color_degraded");
+    else
+        START_COLOR("color_good");
 
     for (walk = format_up; *walk != '\0'; walk++) {
         if (*walk != '%') {
index 8b390ab61e6f2c07f8090bb4c8fba4cfde40285e..83c717e7a7b63218a761c337ef32bfc91dfaf2d4 100644 (file)
@@ -342,7 +342,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface,
         if (info.flags & WIRELESS_INFO_FLAG_HAS_QUALITY)
             START_COLOR((info.quality < info.quality_average ? "color_degraded" : "color_good"));
         else
-            START_COLOR("color_good");
+            START_COLOR((BEGINS_WITH(ip_address, "no IP") ? "color_degraded" : "color_good"));
     } else {
         walk = format_down;
         START_COLOR("color_bad");