diff options
-rwxr-xr-x | volsv | 91 |
1 files changed, 0 insertions, 91 deletions
@@ -1,91 +0,0 @@ -#!/bin/sh -# print error message -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 - "up" | "-i") pamixer -i 5 ;; - "down" | "-d") pamixer -d 5 ;; - "toggle" | "-t") pamixer -t ;; - "mic" | "-m") pamixer --source 1 -t ;; - "getv" | "-v") printf "%s%%\n" "$(pamixer --get-volume)" ;; - "getm" | "-g") pamixer --get-mute | sed 's/[Ff]alse/\[on\]/;s/[Tt]rue/\[off\]/' ;; - *) printerror "$1" ;; - esac -} -# if alsa -alsasv () { - DEVICE=`pgrep -x bluealsa >/dev/null && echo -n "bluealsa"` - if [ -z "$DEVICE" ]; then - case "$1" in - "up" | "-i") amixer sset Master 5%+ ;; - "down" | "-d") amixer sset Master 5%- ;; - "toggle" | "-t") amixer sset Master toggle ;; - "mic" | "-m") amixer sset Capture toggle ;; - "getv" | "-v") amixer sget Master | grep '\[[0-9]*\%\]' | sed "s/ /\n/g" | grep '%' | sed 's/\[//;s/\]//g' ;; - "getm" | "-g") amixer sget Master | grep '\[o[fn]' | cut -d' ' -f8 | head -1 ;; - *) printerror "$1" ;; - esac - elif [ -z `amixer -D $DEVICE controls` ]; then - case "$1" in - "up" | "-i") amixer sset Master 5%+ ;; - "down" | "-d") amixer sset Master 5%- ;; - "toggle" | "-t") amixer sset Master toggle ;; - "mic" | "-m") amixer sset Capture toggle ;; - "getv" | "-v") amixer sget Master | grep '\[[0-9]*\%\]' | sed "s/ /\n/g" | grep '%' | sed 's/\[//;s/\]//g' ;; - "getm" | "-g") amixer sget Master | grep '\[o[fn]' | cut -d' ' -f8 | head -1 ;; - *) printerror "$1" ;; - esac - else - 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%- ;; - "toggle" | "-t") amixer -D "$DEVICE" sset "$MIXER" toggle ;; - "getv" | "-v") amixer -D "$DEVICE" sget "$MIXER" | grep '\[[0-9]*\%\]' | sed "s/ /\n/g" | grep '%' | sed 's/\[//;s/\]//g' | head -1;; - "getm" | "-g") amixer -D "$DEVICE" sget "$MIXER" | grep '\[o[fn]' | cut -d' ' -f9 | head -1 ;; - *) printerror "$1" ;; - esac - fi -} -#Search input for -echo "$@" | grep -q ' *-h *' && echo \ -"Volsv is Free software. You can use it for any purpose, but I make no guerantee about its usability or fitness "\ -"for any particular purpose. You are also free to redistribute, modify, and distribute your modifications to "\ -"volsv. Volsv is distributed under the BSD 3-Clause license to ensure full license compatibility with GNU, "\ -"Linux, and BSD operating systems. A copy of this license is included in the repository.\n\n"\ -"Volsv is a script designed to control the volume of a *NIX machine. The commands/flags are as follows: -increase volume: 'up' or '-i' -decrease volume: 'down' or '-d' -toggle volume mute: 'toggle' or '-t' -toggle mic mute: 'mic' or '-m' -get volume level: 'getv' or '-v' -get mute state: 'getm' or '-g'" && exit - -for i in $@; do - if pgrep -x pulseaudio >/dev/null; then - pulsesv $i - elif pgrep -x pipewire >/dev/null; then - pulsesv $i - elif pgrep -x sndiod >/dev/null; then - sndiosv $i - else - alsasv $i - fi - pgrep -x dwmblocks >/dev/null && pkill -RTMIN+13 dwmblocks - #pgrep -x dwmbar >/dev/null && dwmbar-signal volume -done |