Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Volume controls
- # do nothing if package is removed
- FUNC_LIB=/etc/acpi/functions.sh
- [ -e $FUNC_LIB ] || exit 0
- if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
- . $FUNC_LIB
- action=$1
- VOLUME_LABEL='LineOut'
- HEADPHONE_LABEL='iSpeaker'
- usage() {
- cat <<EOF >&2
- Usage: $0 up|down|toggle
- EOF
- exit 1
- }
- AMIXER=/usr/bin/amixer
- if ! [ -x $AMIXER ]; then
- echo "$AMIXER not available" >&2
- exit 1
- fi
- case "$action" in
- toggle)
- # muting $VOLUME_LABEL affects the headphone jack but not the speakers
- $AMIXER -q sset $VOLUME_LABEL toggle
- # muting $HEADPHONE_LABEL affects the speakers but not the headphone jack
- $AMIXER -q sset $HEADPHONE_LABEL toggle
- ;;
- down)
- amixer -q sset PCM 6- unmute
- amixer -q sset $VOLUME_LABEL 2- unmute
- amixer -q sset $HEADPHONE_LABEL unmute
- ;;
- up)
- amixer -q sset PCM 6+ unmute
- amixer -q sset $VOLUME_LABEL 4+ unmute
- amixer -q sset $HEADPHONE_LABEL unmute
- ;;
- *)
- usage
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment