Implement mute on oss
Patch status: superseded
Patch by Baptiste Daroussin
To apply this patch, use:
curl http://cr.i3wm.org/patch/90/raw.patch | git am
b/src/print_volume.c
13 |
@@ -177,6 +177,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * |
14 |
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
15 |
char mixerpath[] = "/dev/mixer"; |
16 |
int mixfd, vol, devmask = 0; |
17 |
+ int pbval = 1; |
18 |
|
19 |
if ((mixfd = open(mixerpath, O_RDWR)) < 0) |
20 |
return; |
21 |
@@ -185,6 +186,12 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * |
22 |
if (ioctl(mixfd, MIXER_READ(0),&vol) == -1) |
23 |
return; |
24 |
|
25 |
+ if ((vol & 0x7f) == 0 && (vol >> 8) & 0x7f == 0) |
26 |
+ pbval = 0; |
27 |
+ |
28 |
+ if (!pbval) |
29 |
+ START_COLOR("color_bad"); |
30 |
+ |
31 |
const char *walk = fmt; |
32 |
for (; *walk != '\0'; walk++) { |
33 |
if (*walk != '%') { |