From 1c4677a644dfc504d64a58f1b6bb81302eabac9b Mon Sep 17 00:00:00 2001 From: Simon Elsbrock Date: Wed, 5 Sep 2012 18:39:47 +0200 Subject: turn volume into red if muted fixes #743 --- src/print_volume.c | 9 +++++++-- 1 file 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; } -- cgit v1.2.3