Configuration file for dwm-bar on macbook air
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

  1. #!/bin/sh
  2. # A dwm_bar function to show the master volume of ALSA
  3. # Joe Standring <git@joestandring.com>
  4. # GNU GPLv3
  5. # Dependencies: alsa-utils
  6. dwm_alsa () {
  7. STATUS=$(amixer sget Master | tail -n1 | sed -r "s/.*\[(.*)\]/\1/")
  8. VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")
  9. printf "%s" "$SEP1"
  10. if [ "$IDENTIFIER" = "unicode" ]; then
  11. if [ "$STATUS" = "off" ]; then
  12. printf "🔇"
  13. else
  14. #removed this line becuase it may get confusing
  15. if [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
  16. printf "🔈 %s%%" "$VOL"
  17. elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
  18. printf "🔉 %s%%" "$VOL"
  19. else
  20. printf "🔊 %s%%" "$VOL"
  21. fi
  22. fi
  23. else
  24. if [ "$STATUS" = "off" ]; then
  25. printf "MUTE"
  26. else
  27. # removed this line because it may get confusing
  28. if [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
  29. printf "VOL %s%%" "$VOL"
  30. elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
  31. printf "VOL %s%%" "$VOL"
  32. else
  33. printf "VOL %s%%" "$VOL"
  34. fi
  35. fi
  36. fi
  37. printf "%s\n" "$SEP2"
  38. }
  39. dwm_alsa