Skip to content

Instantly share code, notes, and snippets.

@pfactum
Created January 5, 2013 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfactum/a15a0dcd034172de3a29 to your computer and use it in GitHub Desktop.
Save pfactum/a15a0dcd034172de3a29 to your computer and use it in GitHub Desktop.
#!/bin/sh
# amixer options
CHANNEL=Master # usually Master, but for Asus EEE, this is iSpeaker
CARD=0 # Which sound card, if your system has more than one?
VOL_STEP=2 # amount to increase / decrease volume
# notify-send options
DELAY=1000 # milliseconds to show the OSD
if [ "$1" = "mute" ]; then
amixer -c $CARD set $CHANNEL toggle >/dev/null 2>&1
elif [ "$1" = "up" ]; then
amixer -c $CARD set $CHANNEL $VOL_STEP+ >/dev/null 2>&1
elif [ "$1" = "down" ]; then
amixer -c $CARD set $CHANNEL $VOL_STEP- >/dev/null 2>&1
else
echo "Usage: $0 up|down|mute"
exit 1
fi
STATUS=$(amixer -c $CARD sget ${CHANNEL} | grep -c "\\[on\\]")
VOLUME=$(amixer -c $CARD sget ${CHANNEL} | awk '$0 ~ "%" { vol=$(NF-2); \
gsub("\\[", "", vol); gsub("\\]", "",vol); print vol; exit; }' )
if [ $STATUS -eq 0 ]; then
volnoti-show -m
else
volnoti-show $VOLUME
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment