Created
January 10, 2022 17:01
-
-
Save tyjak/418ff6f6ff9f3c0ea5adc22fcf43d65b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# switch a2dp ot hfh codec for bluetooth headset to have quality sound or mic | |
# GistID: 418ff6f6ff9f3c0ea5adc22fcf43d65b | |
HEADSET=$1 | |
HIGH_QUALITY=$(pacmd list-cards | grep -B5 -A20 -c -e 'active profile: <a2dp_sink>' -e 'device.description = "'$HEADSET'"') | |
echo "test: $HIGH_QUALITY" | |
QUALITY=a2dp_sink | |
if [ $HIGH_QUALITY -eq 2 ] | |
then | |
QUALITY=handsfree_head_unit | |
fi | |
pacmd set-card-profile $(pacmd list-cards | grep -B5 'device.description = "'$HEADSET'"' | head -1 | cut -d":" -f2 | tr -d " ") $QUALITY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment