Skip to content

Instantly share code, notes, and snippets.

@Y-LyN-10
Last active November 11, 2019 15:25
Show Gist options
  • Save Y-LyN-10/9ca97d85e33effa4c8f1fd830f823bd3 to your computer and use it in GitHub Desktop.
Save Y-LyN-10/9ca97d85e33effa4c8f1fd830f823bd3 to your computer and use it in GitHub Desktop.
Toggle profiles of Bose35 headphones. When microphone is needed - use the "headset_head_unit", otherwise - use a2dp for high-quality audio.
#!/bin/sh
HEADPHONES_NAME='Bose'; # Replace with your unique (or not so) device name
INDEX=`pacmd list-cards | grep -B5 -P $HEADPHONES_NAME | head -1 | awk '{print $2}'`;
pacmd list-cards | grep "active profile: <a2dp_sink>"
TOGGLE=$?
if [ $TOGGLE -eq 0 ]; then
pacmd set-card-profile $INDEX headset_head_unit
else
pacmd set-card-profile $INDEX a2dp_sink
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment