35 lines
1 KiB
Bash
Executable file
35 lines
1 KiB
Bash
Executable file
#!/bin/sh
|
|
# Fetch current audio level
|
|
# (in current default output)
|
|
|
|
info=$(amixer get Master | grep -m 1 '[0-9]*%')
|
|
|
|
if [ "$?" != 0 ] ; then
|
|
echo "Failed to get Master volume"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "${info##*\[off\]}" ] ; then
|
|
echo " ──────────"
|
|
exit 0
|
|
fi
|
|
|
|
vol="${info#*\[}"
|
|
vol="${vol%%%\]*}"
|
|
|
|
case 1 in
|
|
$((vol >= 100)) ) bar="━━━━━━━━━━" ;;
|
|
$((vol >= 90)) ) bar="━━━━━━━━━─" ;;
|
|
$((vol >= 80)) ) bar="━━━━━━━━──" ;;
|
|
$((vol >= 70)) ) bar="━━━━━━━───" ;;
|
|
$((vol >= 60)) ) bar="━━━━━━────" ;;
|
|
$((vol >= 50)) ) bar="━━━━━─────" ;;
|
|
$((vol >= 40)) ) bar="━━━━──────" ;;
|
|
$((vol >= 30)) ) bar="━━━───────" ;;
|
|
$((vol >= 20)) ) bar="━━────────" ;;
|
|
$((vol >= 10)) ) bar="━─────────" ;;
|
|
$((vol >= 0)) ) bar="──────────" ;;
|
|
esac
|
|
|
|
# Print and notify
|
|
echo " $bar"
|