summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
authorAaron Marcher <info@nulltime.net>2016-10-13 12:15:18 +0200
committerGitHub <noreply@github.com>2016-10-13 12:15:18 +0200
commit59ed3b6d8d594e00d72ecd3beadb512f797146ee (patch)
tree9c5eb60ff2a8f32ee47321737aec1b5d4ebb0106 /slstatus.c
parent97c745e10e3f0710db4b2c84340171f915f2f6c6 (diff)
parent393b09644a253da1250305caade50d9c726de27d (diff)
Merge pull request #24 from jodizzle/feat/mute
Restore "mute" message
Diffstat (limited to 'slstatus.c')
-rw-r--r--slstatus.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/slstatus.c b/slstatus.c
index d442776..efdc9b0 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -472,6 +472,7 @@ uid(void)
static char *
vol_perc(const char *card)
{
+ int mute;
long int vol, max, min;
snd_mixer_t *handle;
snd_mixer_elem_t *elem;
@@ -495,11 +496,14 @@ vol_perc(const char *card)
snd_mixer_handle_events(handle);
snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
snd_mixer_selem_get_playback_volume(elem, 0, &vol);
+ snd_mixer_selem_get_playback_switch(elem, 0, &mute);
snd_mixer_selem_id_free(s_elem);
snd_mixer_close(handle);
- if (max == 0)
+ if (!mute)
+ return smprintf("mute");
+ else if (max == 0)
return smprintf("0%%");
else
return smprintf("%lu%%", ((uint_fast16_t)(vol * 100) / max));