Last active
September 4, 2016 17:28
-
-
Save tatic0/4579093 to your computer and use it in GitHub Desktop.
set amixer volume with zenity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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