summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/i3status.man8
-rw-r--r--src/first_network_device.c1
-rw-r--r--src/print_volume.c11
3 files changed, 16 insertions, 4 deletions
diff --git a/man/i3status.man b/man/i3status.man
index 7d81203..01fa9ce 100644
--- a/man/i3status.man
+++ b/man/i3status.man
@@ -299,7 +299,9 @@ network interface found on the system (excluding devices starting with "lo").
*Example order*: +wireless wlan0+
-*Example format*: +W: (%quality at %essid, %bitrate / %frequency) %ip+
+*Example format_up*: +W: (%quality at %essid, %bitrate / %frequency) %ip+
+
+*Example format_down*: +W: down+
=== Ethernet
@@ -313,7 +315,9 @@ network interface found on the system (excluding devices starting with "lo").
*Example order*: +ethernet eth0+
-*Example format*: +E: %ip (%speed)+
+*Example format_up*: +E: %ip (%speed)+
+
+*Example format_down*: +E: down+
=== Battery
diff --git a/src/first_network_device.c b/src/first_network_device.c
index 430f1d5..b930f53 100644
--- a/src/first_network_device.c
+++ b/src/first_network_device.c
@@ -127,6 +127,7 @@ static net_type_t iface_type(const char *ifname) {
return NET_TYPE_OTHER;
#endif
+ return NET_TYPE_OTHER;
}
const char *first_eth_interface(const net_type_t type) {
diff --git a/src/print_volume.c b/src/print_volume.c
index 51e84f3..be6a1d7 100644
--- a/src/print_volume.c
+++ b/src/print_volume.c
@@ -211,6 +211,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
#if defined(__OpenBSD__)
int oclass_idx = -1, master_idx = -1, master_mute_idx = -1;
+ int master_next = AUDIO_MIXER_LAST;
mixer_devinfo_t devinfo, devinfo2;
mixer_ctrl_t vinfo;
@@ -228,12 +229,17 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
devinfo2.index = 0;
while (ioctl(mixfd, AUDIO_MIXER_DEVINFO, &devinfo2) >= 0) {
- if ((devinfo2.type == AUDIO_MIXER_VALUE) && (devinfo2.mixer_class == oclass_idx) && (strncmp(devinfo2.label.name, AudioNmaster, MAX_AUDIO_DEV_LEN) == 0))
+ if ((devinfo2.type == AUDIO_MIXER_VALUE) && (devinfo2.mixer_class == oclass_idx) && (strncmp(devinfo2.label.name, AudioNmaster, MAX_AUDIO_DEV_LEN) == 0)) {
master_idx = devinfo2.index;
+ master_next = devinfo2.next;
+ }
if ((devinfo2.type == AUDIO_MIXER_ENUM) && (devinfo2.mixer_class == oclass_idx) && (strncmp(devinfo2.label.name, AudioNmute, MAX_AUDIO_DEV_LEN) == 0))
- master_mute_idx = devinfo2.index;
+ if (master_next == devinfo2.index)
+ master_mute_idx = devinfo2.index;
+ if (master_next != AUDIO_MIXER_LAST)
+ master_next = devinfo2.next;
devinfo2.index++;
}
@@ -246,6 +252,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
vinfo.dev = master_idx;
vinfo.type = AUDIO_MIXER_VALUE;
+ vinfo.un.value.num_channels = devinfo.un.v.num_channels;
if (ioctl(mixfd, AUDIO_MIXER_READ, &vinfo) == -1)
goto out;