Skip to content

Instantly share code, notes, and snippets.

@lyleunderwood
Created May 9, 2011 23:21
Show Gist options
  • Save lyleunderwood/963629 to your computer and use it in GitHub Desktop.
Save lyleunderwood/963629 to your computer and use it in GitHub Desktop.
#!/bin/bash
# this assumes you have amixer and notify-send installed:
# sudo apt-get install alsa-utils libnotify-bin
# this is guaranteed to work on MY system, which is ubuntu
# 11.04 with pulseaudio (the default). if anything is likely
# to change on your system, it's gonna be the name of the
# channel you want to affect.
# if you don't want the notifications, just comment out all
# lines with notify-send :)
# put this in ~/bin/ and run
# chmod +x ~/bin/vol
# to make it executable, and hopefully loaded up from your
# $PATH so that it can be accessed from everywhere.
if [ $1 = "mute" ]
then
amixer set Master mute
notify-send "Volume muted"
elif [ $1 = "unmute" ]
then
amixer set Master unmute
notify-send "Volume unmuted"
elif [ $1 = "up" ]
then
str=`amixer set Master 5+`
vol=`echo $str| awk '{print $22}'`
notify-send "Volume $vol"
elif [ $1 = "down" ]
then
str=`amixer set Master 5-`
vol=`echo $str| awk '{print $22}'`
notify-send "Volume $vol"
else
str=`amixer set Master $1`
vol=`echo $str| awk '{print $22}'`
notify-send "Volume $vol"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment