commit 5fae7bf96f546a393e36897ef1be12c1e259becc parent f21ee4d997f6b06a5289b11541c0118f23e4d3b0 Author: clamiax <smoppy@gmail.com> Date: Tue, 6 Jan 2015 19:22:01 +0100 Add volume informations (append a '*' if mute is on) Diffstat:
M | dwmstatus | | | 11 | ++++++++++- |
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dwmstatus b/dwmstatus @@ -43,14 +43,23 @@ gettemp() { echo "${r}C" } +getvol() { + fds=$(amixer get Master |tail -1 |sed 's/.*\[\([^ ]*\)\] \[\([^ ]*\)\] \[\([^ ]*\)\].*/\1|\2|\3/') + pct=$(echo $fds |cut -d'|' -f1) + dcbl=$(echo $fds |cut -d'|' -f2) + mute=$(echo $fds |cut -d'|' -f3) + [ "$mute" = "on" ] && echo $pct || echo "${pct}*" +} + main() { battery=$(getbattery) iwlink=$(getiwlink wlan0) date=$(getdate) freqs=$(getfreqs) temp=$(gettemp) + vol=$(getvol) - status="B:$battery T:$temp W:$iwlink ($freqs) $date" + status="B:$battery T:$temp W:$iwlink V:$vol ($freqs) $date" echo "$status" }