i3 - improved tiling WM


Show degraded colors in case volume is muted with OSS

Patch status: merged

Patch by Baptiste Daroussin

To apply this patch, use:
curl http://cr.i3wm.org/patch/91/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
+        pbval = 1;
18
 
19
         if ((mixfd = open(mixerpath, O_RDWR)) < 0)
20
                 return;
21
@@ -185,6 +186,11 @@ 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
+                START_COLOR("color_degraded");
27
+                pbval = 0;
28
+        }
29
+
30
         const char *walk = fmt;
31
         for (; *walk != '\0'; walk++) {
32
                 if (*walk != '%') {