pash 931 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # define functions to assist with operations
  3. pash_increase() {
  4. echo "increasing volume on all active sinks..."
  5. local sinks=$(pactl list short sinks | grep "RUNNING\|IDLE" | awk '{print $1}')
  6. echo "$sinks" | while IFS= read -r sink ; do pactl set-sink-volume $sink +5%; done
  7. }
  8. pash_decrease() {
  9. echo "decreasing volume on all active sinks..."
  10. local sinks=$(pactl list short sinks | grep "RUNNING\|IDLE" | awk '{print $1}')
  11. echo "$sinks" | while IFS= read -r sink ; do pactl set-sink-volume $sink -5%; done
  12. }
  13. pash_mute() {
  14. echo "toggling mute on all active sinks..."
  15. local sinks=$(pactl list short sinks | grep "RUNNING\|IDLE" | awk '{print $1}')
  16. echo "$sinks" | while IFS= read -r sink ; do pactl set-sink-mute $sink toggle; done
  17. }
  18. # select operation from list
  19. case $1 in
  20. increase)
  21. pash_increase
  22. ;;
  23. decrease)
  24. pash_decrease
  25. ;;
  26. mute)
  27. pash_mute
  28. ;;
  29. *)
  30. echo "unknown command ${1}..."
  31. ;;
  32. esac