aboutsummaryrefslogtreecommitdiffstats
path: root/testing/i3status/no-pulseaudio.patch
blob: 94baae7e536f739bfa4e8dd52c370390a62870e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
diff -upr i3status-2.10.orig/Makefile i3status-2.10/Makefile
--- i3status-2.10.orig/Makefile	2016-01-07 19:53:31.912304558 +0100
+++ i3status-2.10/Makefile	2016-01-07 19:55:02.869685848 +0100
@@ -24,6 +24,10 @@ LIBS+=-lyajl
 LIBS+=-lpulse
 LIBS+=-lm
 
+ifeq ($(OS),OpenBSD)
+LIBS+=-lpthread
+endif
+
 VERSION=2.10
 GIT_VERSION="2.10 (2016-01-01)"
 OS:=$(shell uname)
@@ -70,10 +74,8 @@ CFLAGS += -idirafter yajl-fallback
 OBJS:=$(wildcard src/*.c *.c)
 OBJS:=$(OBJS:.c=.o)
 
-ifeq ($(OS),OpenBSD)
 OBJS:=$(filter-out src/pulse.o, $(OBJS))
-LIBS:=$(filter-out -lpulse, $(LIBS)) -lpthread
-endif
+LIBS:=$(filter-out -lpulse, $(LIBS))
 
 src/%.o: src/%.c include/i3status.h
 	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
diff -upr i3status-2.10.orig/src/print_volume.c i3status-2.10/src/print_volume.c
--- i3status-2.10.orig/src/print_volume.c	2016-01-07 19:53:31.912304558 +0100
+++ i3status-2.10/src/print_volume.c	2016-01-07 19:53:44.447718125 +0100
@@ -60,50 +60,6 @@ void print_volume(yajl_gen json_gen, cha
         free(instance);
     }
 
-#ifndef __OpenBSD__
-    /* Try PulseAudio first */
-
-    /* If the device name has the format "pulse[:N]" where N is the
-     * index of the PulseAudio sink then force PulseAudio, optionally
-     * overriding the default sink */
-    if (!strncasecmp(device, "pulse", strlen("pulse"))) {
-        uint32_t sink_idx = device[5] == ':' ? (uint32_t)atoi(device + 6)
-                                             : DEFAULT_SINK_INDEX;
-        int cvolume = pulse_initialize() ? volume_pulseaudio(sink_idx) : 0;
-        int ivolume = DECOMPOSE_VOLUME(cvolume);
-        bool muted = DECOMPOSE_MUTED(cvolume);
-        if (muted) {
-            START_COLOR("color_degraded");
-            pbval = 0;
-        }
-        /* negative result means error, stick to 0 */
-        if (ivolume < 0)
-            ivolume = 0;
-        outwalk = apply_volume_format(muted ? fmt_muted : fmt,
-                                      outwalk,
-                                      ivolume);
-        goto out;
-    } else if (!strcasecmp(device, "default") && pulse_initialize()) {
-        /* no device specified or "default" set */
-        int cvolume = volume_pulseaudio(DEFAULT_SINK_INDEX);
-        int ivolume = DECOMPOSE_VOLUME(cvolume);
-        bool muted = DECOMPOSE_MUTED(cvolume);
-        if (ivolume >= 0) {
-            if (muted) {
-                START_COLOR("color_degraded");
-                pbval = 0;
-            }
-            outwalk = apply_volume_format(muted ? fmt_muted : fmt,
-                                          outwalk,
-                                          ivolume);
-            goto out;
-        }
-        /* negative result means error, fail PulseAudio attempt */
-    }
-/* If some other device was specified or PulseAudio is not detected,
- * proceed to ALSA / OSS */
-#endif
-
 #ifdef LINUX
     int err;
     snd_mixer_t *m;