configuration/local/bin/soundinfo

18 lines
367 B
Bash
Executable File

#!/bin/bash
if grep -q "\[on\]" <(amixer get Master); then
current="$(amixer get Master | sed -n '/%/s/.*\[\(.*\)%\].*/\1/p' | head -1)"
if (( current <= 25 )); then
echo "none"
elif (( current <= 50 )); then
echo "low"
elif (( current <= 75 )); then
echo "medium"
else
echo "high"
fi
else
echo "mute"
fi