dotfiles/scripts/status/micstat
2024-12-28 14:36:59 -06:00

29 lines
971 B
Bash
Executable file

#!/bin/sh
# Fetch current mic levels
# (in current default Capture)
info=$(amixer get Capture | grep -m 1 '[0-9]*%')
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
echo "󰍬 $bar"