diff options
-rw-r--r--[-rwxr-xr-x] | volsv | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1,4 +1,8 @@ #!/bin/sh +# print error message +printerror () { + echo "$1 is not a recognized command or flag" +} # if pulseaudio pulsesv () { case "$1" in @@ -6,6 +10,8 @@ pulsesv () { "down" | "-d") pamixer -d 5 ;; "toggle" | "-t") pamixer -t ;; "mic" | "-m") pamixer --source 1 -t ;; + "getm" | "-g") ;; + *) printerror "$1" ;; esac } # if alsa @@ -14,7 +20,19 @@ alsasv () { "up" | "-i") amixer sset Master 5%+ ;; "down" | "-d") amixer sset Master 5%- ;; "toggle" | "-t") amixer sset Master toggle ;; + "getm" | "-g") ;; + *) printerror "$1" ;; esac } -# check which it is -[ ! -z $(pgrep pulseaudio) ] && pulsesv $1 || alsasv $1 ; pkill -RTMIN+10 dwmblocks +#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." && exit + +for i in $@; do + pgrep -x pulseaudio >/dev/null && pulsesv $1 || alsasv $1 + pgrep -x dwmblocks >/dev/null && pkill -RTMIN+10 dwmblocks + pgrep -x dwmbar >/dev/null && dwmbar-signal volume +done |