]> git.sur5r.net Git - i3/i3status/commitdiff
Bugfix: Don’t show colors in wireless info if colors are disabled (Thanks shatter)
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 26 Sep 2009 11:26:13 +0000 (13:26 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 26 Sep 2009 11:26:13 +0000 (13:26 +0200)
src/get_wireless_info.c
src/output.c

index 529ba71a44e2d242c9df7f6e2a0149f4105c5608..2cdcb8cf0cbb8f5044791e96cc7d0a612131d658 100644 (file)
@@ -33,9 +33,7 @@ const char *get_wireless_info() {
                 if (sscanf(interfaces, "%*[^:]: 0000 %d", &quality) != 1)
                         continue;
                 if ((quality == UCHAR_MAX) || (quality == 0)) {
-                        if (use_colors)
-                                (void)snprintf(part, sizeof(part), "%sW: down%s", color("#FF0000"), endcolor());
-                        else (void)snprintf(part, sizeof(part), "W: down");
+                        (void)snprintf(part, sizeof(part), "%sW: down%s", color("#FF0000"), endcolor());
                 } else (void)snprintf(part, sizeof(part), "%sW: (%03d%%) %s%s",
                                 color("#00FF00"), quality, get_ip_addr(wlan_interface), endcolor());
                 return part;
index c153a01126dcf69ce0dc92a56c4f47090f9eeb7f..eee458bd9be878e75e04a68a35aa952456fea24e 100644 (file)
@@ -26,6 +26,10 @@ void write_error_to_statusbar(const char *message) {
  */
 char *color(const char *colorstr) {
         static char colorbuf[32];
+        if (!use_colors) {
+                colorbuf[0] = '\0';
+                return colorbuf;
+        }
 #ifdef DZEN
         (void)snprintf(colorbuf, sizeof(colorbuf), "^fg(%s)", colorstr);
 #elif XMOBAR