feat: move ~/bin to ~/.local/bin
This commit is contained in:
parent
a65adc368b
commit
b3b3435a9e
14 changed files with 7 additions and 7 deletions
47
bin/set-vol
47
bin/set-vol
|
@ -1,47 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# TODO: multiple fast invocation cause volume not to be updated
|
||||
|
||||
PACTL_SINK='@DEFAULT_SINK@'
|
||||
SINK="$PACTL_SINK"
|
||||
|
||||
function get_vol() {
|
||||
VOL="$(pactl get-sink-volume "$SINK" 2> /dev/null)"
|
||||
|
||||
if [ -n "$VOL" ]; then
|
||||
CMD='pactl set-sink-volume'
|
||||
else
|
||||
CMD='amixer sset'
|
||||
SINK='Master'
|
||||
|
||||
VOL="$(amixer sget "$SINK")"
|
||||
fi
|
||||
}
|
||||
|
||||
set +e
|
||||
get_vol
|
||||
set -e
|
||||
|
||||
VOL="$(echo "$VOL" | grep -Po '\d+(?=%)' | head -n 1)"
|
||||
VOL="$((VOL - VOL % "$1"))"
|
||||
|
||||
case "${1:0:1}" in
|
||||
'')
|
||||
exit 1
|
||||
;;
|
||||
'+'|'-')
|
||||
VOL="$((VOL + "$1"))"
|
||||
;;
|
||||
*)
|
||||
VOL="$1"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ "$VOL" -lt 0 ] && VOL=0
|
||||
[ "$VOL" -gt 100 ] && VOL=100
|
||||
|
||||
$CMD "$SINK" "$VOL%" > /dev/null
|
||||
pactl set-sink-mute "$PACTL_SINK" 0
|
||||
|
||||
echo "$VOL"
|
Loading…
Add table
Add a link
Reference in a new issue