From: Simon Elsbrock Date: Wed, 5 Sep 2012 16:39:47 +0000 (+0200) Subject: turn volume into red if muted X-Git-Tag: 2.6~4 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3status;a=commitdiff_plain;h=1c4677a644dfc504d64a58f1b6bb81302eabac9b;hp=674d28e192680e2ebe9c1e83455ec034e451432f turn volume into red if muted fixes #743 --- 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; }