Bugfix: Don’t show colors in wireless info if colors are disabled (Thanks shatter)
This commit is contained in:
parent
89ad3dbaa2
commit
cdb450376e
@ -33,9 +33,7 @@ const char *get_wireless_info() {
|
|||||||
if (sscanf(interfaces, "%*[^:]: 0000 %d", &quality) != 1)
|
if (sscanf(interfaces, "%*[^:]: 0000 %d", &quality) != 1)
|
||||||
continue;
|
continue;
|
||||||
if ((quality == UCHAR_MAX) || (quality == 0)) {
|
if ((quality == UCHAR_MAX) || (quality == 0)) {
|
||||||
if (use_colors)
|
|
||||||
(void)snprintf(part, sizeof(part), "%sW: down%s", color("#FF0000"), endcolor());
|
(void)snprintf(part, sizeof(part), "%sW: down%s", color("#FF0000"), endcolor());
|
||||||
else (void)snprintf(part, sizeof(part), "W: down");
|
|
||||||
} else (void)snprintf(part, sizeof(part), "%sW: (%03d%%) %s%s",
|
} else (void)snprintf(part, sizeof(part), "%sW: (%03d%%) %s%s",
|
||||||
color("#00FF00"), quality, get_ip_addr(wlan_interface), endcolor());
|
color("#00FF00"), quality, get_ip_addr(wlan_interface), endcolor());
|
||||||
return part;
|
return part;
|
||||||
|
@ -26,6 +26,10 @@ void write_error_to_statusbar(const char *message) {
|
|||||||
*/
|
*/
|
||||||
char *color(const char *colorstr) {
|
char *color(const char *colorstr) {
|
||||||
static char colorbuf[32];
|
static char colorbuf[32];
|
||||||
|
if (!use_colors) {
|
||||||
|
colorbuf[0] = '\0';
|
||||||
|
return colorbuf;
|
||||||
|
}
|
||||||
#ifdef DZEN
|
#ifdef DZEN
|
||||||
(void)snprintf(colorbuf, sizeof(colorbuf), "^fg(%s)", colorstr);
|
(void)snprintf(colorbuf, sizeof(colorbuf), "^fg(%s)", colorstr);
|
||||||
#elif XMOBAR
|
#elif XMOBAR
|
||||||
|
Loading…
Reference in New Issue
Block a user