diff options
-rwxr-xr-x | volsv | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -3,6 +3,18 @@ printerror () { echo "$1 is not a recognized command or flag" } +# if sndio +sndiosv () { + case "$1" in + "up" | "-i") sndioctl output.level=+0.05 ;; + "down" | "-d") sndioctl output.level=-0.05 ;; + "toggle" | "-t") sndioctl output.mute=! ;; + "mic" | "-m") sndioctl input.mute=! ;; + "getv" | "-v") printf "%s%%" `sndioctl output.level | rev | cut -d'.' -f1 | rev | cut -c 1,2` ;; + "getm" | "-g") sndioctl output.mute | cut -d'=' -f2 | sed 's/1/[off]/;s/0/[on]/' ;; + *) printerror "$1" ;; + esac +} # if pulseaudio pulsesv () { case "$1" in @@ -17,7 +29,7 @@ pulsesv () { } # if alsa alsasv () { - DEVICE="$(pgrep -x bluealsa >/dev/null && echo -n "bluealsa")" + DEVICE=`pgrep -x bluealsa >/dev/null && echo -n "bluealsa"` if [ -z "$DEVICE" ]; then case "$1" in "up" | "-i") amixer sset Master 5%+ ;; @@ -28,7 +40,7 @@ alsasv () { "getm" | "-g") amixer sget Master | grep '\[o[fn]' | cut -d' ' -f8 | head -1 ;; *) printerror "$1" ;; esac - elif [ -z "$(amixer -D $DEVICE controls)" ]; then + elif [ -z `amixer -D $DEVICE controls` ]; then case "$1" in "up" | "-i") amixer sset Master 5%+ ;; "down" | "-d") amixer sset Master 5%- ;; @@ -39,7 +51,7 @@ alsasv () { *) printerror "$1" ;; esac else - MIXER="$(amixer -D $DEVICE | grep 'A2DP' | cut -d"'" -f2)" + MIXER=`amixer -D $DEVICE | grep 'A2DP' | cut -d"'" -f2` case "$1" in "up" | "-i") amixer -D "$DEVICE" sset "$MIXER" 5%+ ;; "down" | "-d") amixer -D "$DEVICE" sset "$MIXER" 5%- ;; @@ -65,7 +77,10 @@ get volume level: 'getv' or '-v' get mute state: 'getm' or '-g'" && exit for i in $@; do - pgrep -x pulseaudio >/dev/null && pulsesv $i || pgrep -x pipewire >/dev/null && pulsesv $i || alsasv $i - pgrep -x dwmblocks >/dev/null && pkill -RTMIN+10 dwmblocks - pgrep -x dwmbar >/dev/null && dwmbar-signal volume + pgrep -x pulseaudio >/dev/null && pulsesv $i || \ + pgrep -x pipewire >/dev/null && pulsesv $i || \ + pgrep -x sndiod >/dev/null && sndiosv $i || \ + alsasv $i + #pgrep -x dwmblocks >/dev/null && pkill -RTMIN+10 dwmblocks + #pgrep -x dwmbar >/dev/null && dwmbar-signal volume done |