summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/print_volume.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/print_volume.c b/src/print_volume.c
index dbf5e1f..95a3601 100644
--- a/src/print_volume.c
+++ b/src/print_volume.c
@@ -152,12 +152,14 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
} else avg = (int)val;
/* Check for mute */
+ int pbval;
if (snd_mixer_selem_has_playback_switch(hdl->elem)) {
- int pbval;
if ((err = snd_mixer_selem_get_playback_switch(hdl->elem, 0, &pbval)) < 0)
fprintf (stderr, "i3status: ALSA: playback_switch: %s\n", snd_strerror(err));
- if (!pbval)
+ if (!pbval) {
+ START_COLOR("color_bad");
avg = 0;
+ }
}
const char *walk = fmt;
@@ -199,4 +201,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
*outwalk = '\0';
OUTPUT_FULL_TEXT(buffer);
+
+ if (!pbval)
+ END_COLOR;
}