Advertisement
Guest User

Volume

a guest
Feb 14th, 2011
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #!/bin/sh
  2. amixer sset -c 0 Master $1
  3. channels=`amixer get Master | grep channels: | awk '{printf $3}'`
  4.  
  5. if [ $channels = "Front" ]
  6. then
  7. # mute=`amixer get Master | grep "Front Left:" | awk '{printf $7}' | cut -b2-4` ##Alsa
  8. mute=`amixer get Master | grep "Front Left:" | awk '{printf $6}' | cut -b2-4` ##Pulse
  9. volume=`amixer get Master | grep "Front Left:" | awk '{print ""$4""}'` ##Alsa
  10.  
  11. elif [ $channels = "Mono" ]
  12. then
  13. mute=`amixer get Master | grep Mono: | awk '{printf $6}' | cut -b2-4`
  14. volume=`amixer get Master | grep Mono: | awk '{print ""$3""}'`
  15. fi
  16.  
  17. limits=`amixer get Master | grep Limits | awk '{print ""$5""}'`
  18. volume_level=`expr $volume "*" 100 "/" $limits`
  19.  
  20. if [ $mute = "off" ]
  21. then
  22. notify-send " " -i notification-audio-volume-muted -h int:value:0 -h string:x-canonical-private-synchronous:volume
  23. else
  24. if [ $volume_level -gt 70 ]
  25. then
  26. notify-send " " -i notification-audio-volume-high -h int:value:$volume_level -h string:x-canonical-private-synchronous:volume &
  27. elif [ $volume_level -gt 30 ]
  28. then
  29. notify-send " " -i notification-audio-volume-medium -h int:value:$volume_level -h string:x-canonical-private-synchronous:volume &
  30. elif [ $volume_level -gt 0 ]
  31. then
  32. notify-send " " -i notification-audio-volume-low -h int:value:$volume_level -h string:x-canonical-private-synchronous:volume &
  33. elif [ $volume_level = "0" ]
  34. then
  35. notify-send " " -i notification-audio-volume-muted -h int:value:$volume_level -h string:x-canonical-private-synchronous:volume &
  36. fi
  37. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement