volume script
This commit is contained in:
parent
9c623a24be
commit
465c241cbb
58
dotfiles-old/bin/volume
Executable file
58
dotfiles-old/bin/volume
Executable 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
|
@ -15,4 +15,5 @@
|
||||
.config/i3status/config
|
||||
bin/data
|
||||
bin/displaym
|
||||
bin/volume
|
||||
src/dmenu/config.h
|
||||
|
Loading…
Reference in New Issue
Block a user