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.

34 lines
970 B

  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. VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")
  8. if [ "$IDENTIFIER" = "unicode" ]; then
  9. if [ "$VOL" -eq 0 ]; then
  10. printf "[🔇 %s]\n" "$VOL]\n"
  11. elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
  12. printf "[🔈 %s]\n" "$VOL"
  13. elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
  14. printf "[🔉 %s]\n" "$VOL"
  15. else
  16. printf "[🔊 %s]\n" "$VOL"
  17. fi
  18. else
  19. if [ "$VOL" -eq 0 ]; then
  20. printf "[VOL %s]\n" "$VOL]\n"
  21. elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
  22. printf "[VOL %s]\n" "$VOL"
  23. elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
  24. printf "[VOL %s]\n" "$VOL"
  25. else
  26. printf "[VOL %s]\n" "$VOL"
  27. fi
  28. fi
  29. }
  30. dwm_alsa