Guest User

Untitled

a guest
Jun 24th, 2011
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.07 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Volume controls
  4.  
  5. # do nothing if package is removed
  6. FUNC_LIB=/etc/acpi/functions.sh
  7. [ -e $FUNC_LIB ] || exit 0
  8.  
  9. if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
  10. . $FUNC_LIB
  11. action=$1
  12. VOLUME_LABEL='LineOut'
  13. HEADPHONE_LABEL='iSpeaker'
  14.  
  15. usage() {
  16.     cat <<EOF >&2
  17. Usage: $0 up|down|toggle
  18. EOF
  19.     exit 1
  20. }
  21.  
  22. AMIXER=/usr/bin/amixer
  23.  
  24. if ! [ -x $AMIXER ]; then
  25.     echo "$AMIXER not available" >&2
  26.     exit 1
  27. fi
  28. case "$action" in
  29.     toggle)
  30.         # muting $VOLUME_LABEL affects the headphone jack but not the speakers
  31.         $AMIXER  -q sset $VOLUME_LABEL  toggle
  32.         # muting $HEADPHONE_LABEL affects the speakers but not the headphone jack
  33.         $AMIXER -q sset  $HEADPHONE_LABEL toggle
  34.         ;;
  35.     down)
  36.         amixer -q sset PCM 6- unmute
  37.         amixer -q sset $VOLUME_LABEL 2- unmute
  38.         amixer -q sset $HEADPHONE_LABEL unmute
  39.         ;;
  40.     up)
  41.         amixer -q sset PCM  6+ unmute
  42.         amixer -q sset $VOLUME_LABEL 4+ unmute
  43.         amixer -q sset $HEADPHONE_LABEL unmute
  44.         ;;
  45.     *)
  46.         usage
  47.         ;;
  48. esac
Advertisement
Add Comment
Please, Sign In to add comment