Skip to content

Instantly share code, notes, and snippets.

@nicman23
Last active February 10, 2021 13:02
Show Gist options
  • Save nicman23/a2a80200e1d5d1f65b75846c5f2387b7 to your computer and use it in GitHub Desktop.
Save nicman23/a2a80200e1d5d1f65b75846c5f2387b7 to your computer and use it in GitHub Desktop.
volume manipulation of pipewire split front and back
#!/bin/bash
card_name='Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]' ##### PLEASE EDIT THIS
card_name=$(sed -e 's/\[/\\\[/g' -e 's/\]/\\\]/g' <<< "$card_name")
[[ -z "$1" || -n "$2" ]] && {
echo usage: $(basename $0) '[:num]?(%)(-+)'
echo same number / percentage accepted by 'amixer set'
echo ie vol 5%+
echo ie vol 5
exit 1
}
vol=$1
output=$(pactl info | grep Default\ Sink | cut -f2- -d: | awk '{print $1}')
card=$(aplay -ql | grep "$card_name" | perl -lne 'print $1 if /([0-9])/')
if [ "$output" == 'headphones' ]; then
amixer -c $card set Surround $vol
else
amixer -c $card set Front $vol
amixer -c $card set LFE $vol
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment