Skip to content

Instantly share code, notes, and snippets.

@lyleunderwood
Created June 22, 2011 00:58
Show Gist options
  • Save lyleunderwood/1039303 to your computer and use it in GitHub Desktop.
Save lyleunderwood/1039303 to your computer and use it in GitHub Desktop.
bash script to change volume in ubuntu
#!/bin/bash
# DO THIS FIRST:
# sudo aptitude install libnotify-bin alsa-utils
# INSTALL:
# mkdir ~/bin
# cp ~/Downloads/vol ~/bin/vol
# chmod +x ~/bin/vol
# USAGE:
# vol up
# vol down
# vol mute
# vol unmute
# vol 10+
# vol 5-
# vol 60%
# I usually use this from a launcher which can run arbitrary scripts, such
# as synapse or the alt+f2 launcher in 'buntu.
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