#!/bin/sh # # Author: Örjan Persson # # Toggle the 'External Amplifier', useful to bind to a mute/unmute # button found on some keyboards. (eg HP nc8000) # # What's so special about that, you ask? A normal mute works, but # using the 'External Amplifier' toggles a red led on my laptop # that indicates that sound is off. # # I mute PCM and Headphone instead of Master here. This is because # if you use the gnome-volume-control, it will automatically set # master volume to 0 if you mute master. (Volume lost when unmute.) # Card number to control. ('hw:N' where N is the number) CARD=0 EXTAMP=`amixer -c $CARD sget 'External Amplifier' \ | grep 'Playback \[' | cut -d ' ' -f 5` if [ "$EXTAMP" == "[on]" ];then amixer -c $CARD sset 'External Amplifier' off > /dev/null #amixer -c $CARD sset 'Master' unmute > /dev/null amixer -c $CARD sset 'PCM' mute > /dev/null amixer -c $CARD sset 'Headphone' mute > /dev/null else amixer -c $CARD sset 'External Amplifier' on > /dev/null #amixer -c $CARD sset 'Master' unmute > /dev/null amixer -c $CARD sset 'PCM' unmute > /dev/null amixer -c $CARD sset 'Headphone' unmute > /dev/null fi