turn volume into red if muted

fixes #743
This commit is contained in:
Simon Elsbrock 2012-09-05 18:39:47 +02:00 committed by Michael Stapelberg
parent 674d28e192
commit 1c4677a644

View File

@ -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;
}