1
0

volume script

This commit is contained in:
dtb 2021-07-10 00:48:14 -04:00
parent 9c623a24be
commit 465c241cbb
2 changed files with 59 additions and 0 deletions

58
dotfiles-old/bin/volume Executable file
View File

@ -0,0 +1,58 @@
#!/bin/sh
argv0="$0"
usage() {
printf "\
Usage: %b {absolute,help,relative,status} [ARGUMENT...]\n" "$argv0"
printf "\
Examples:
%b absolute 0 # mute sound output
%b help # print this help text
%b relative 4 # increase the volume by 4 units
%b relative -4 # decrease the volume by 4 units
%b status # print current volume
" "$argv0" "$argv0" "$argv0" "$argv0" "$argv0"
printf "\
The options are matched with [char]*. So \"%b help\"
works the same as \"%b h\".
" "$argv0" "$argv0"
exit 1
}
[ -n "$1" ] || usage
case "$1" in
(a*)
case "$(uname)" in
(NetBSD)
audioctl -w play.gain=$1 >/dev/null
;;
(*) unknown_system
esac
;;
(h*) usage ;;
(r*)
case "$(uname)" in
(NetBSD)
# works. 9.2 STABLE 2021-07
audioctl -w play.gain=$(( \
$( \
audioctl -a \
| grep "play\.gain" \
| cut -d '=' -f 2 \
) + $2)) >/dev/null
;;
(*) unknown_system
esac
;;
(s*)
case "$(uname)" in
(NetBSD)
audioctl -a | grep "play\.gain" | cut -d '=' -f 2
;;
(*) unknown_system
esac
;;
esac

View File

@ -15,4 +15,5 @@
.config/i3status/config
bin/data
bin/displaym
bin/volume
src/dmenu/config.h