Skip to content

Instantly share code, notes, and snippets.

@tatic0
Last active September 4, 2016 17:28
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 tatic0/4579093 to your computer and use it in GitHub Desktop.
Save tatic0/4579093 to your computer and use it in GitHub Desktop.
set amixer volume with zenity
#!/bin/bash
# script to change the volume using amixer + zenity
current_vol=$(amixer -c 0 get 'Master' |tail -1| sed 's/.*\[\([0-9][0-9]\%\)\].*/\1/g'| sed 's/%//g')
function volume {
VOLVALUE=$(zenity --scale --value=$current_vol --text "set volume")
CMD="amixer -c 0 set 'Master' $VOLVALUE%"
echo $CMD
$CMD
};
function error {
echo "please install zenity"
};
if [[ -f /usr/bin/zenity ]];
then echo "OK"
volume
else error
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment