Last active
January 2, 2016 22:08
-
-
Save sean-kang/8367578 to your computer and use it in GitHub Desktop.
Volnoti Control Script.Test environment: arch linux, pulse audio, xfce4.Dependency: amixer, volnoti.volnoti: https://github.com/davidbrazdil/volnoti
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
#!/usr/bin/env bash | |
[[ "$1" == "up" ]] && amixer set Master 5%+ | |
[[ "$1" == "down" ]] && amixer set Master 5%- | |
[[ "$1" == "mute" ]] && amixer sset Master toggle | |
FRONT_LEFT=$(amixer get Master | grep -E '^\s+Front Left') | |
MONO=$(amixer get Master | grep -E '^\s+Mono') | |
if [[ $FRONT_LEFT == "" ]]; then | |
VOL_INFO=$MONO | |
else | |
VOL_INFO=$FRONT_LEFT | |
fi | |
if [[ $VOL_INFO == *off* ]]; then | |
volnoti-show -m | |
else | |
VOL=$(echo $VOL_INFO | grep -o -P '\d+%') | |
volnoti-show $VOL | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment