get-volume 437 B

12345678910111213141516
  1. #!/bin/sh
  2. # script to display the current volume and mute state in dwmblocks
  3. percent="$(amixer sget Master | grep 'Front Left:' | \
  4. awk -F '[\\]\\[]' '{print $2}' | sed 's/\%$//')"
  5. if amixer sget Master | grep -q "off"; then
  6. volume_icon="婢"
  7. elif [ "$percent" -gt 69 ]; then
  8. volume_icon="墳"
  9. elif [ "$percent" -gt 29 ]; then
  10. volume_icon="奔"
  11. else
  12. volume_icon="奄"
  13. fi
  14. printf "%s %s\\n" "$volume_icon" "$percent"