diff options
| author | Simon Elsbrock | 2012-09-05 18:39:47 +0200 | 
|---|---|---|
| committer | Michael Stapelberg | 2012-09-05 23:28:27 +0200 | 
| commit | 1c4677a644dfc504d64a58f1b6bb81302eabac9b (patch) | |
| tree | 4aab940d76c0b2ef6741d07eadfa6612a589993e | |
| parent | modify START_COLOR macro variable naming (diff) | |
turn volume into red if muted
fixes #743
| -rw-r--r-- | src/print_volume.c | 9 | 
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;  } | 
