#!/bin/bash
# systemctl --user restart wireplumber pipewire pipewire-pulse
# Change this to match your device alias (as shown in `pactl list cards`)
DEVICE_ALIAS="SRS-XB100"
# Get the card name for the device
CARD_NAME=$(pactl list cards | awk -v alias="$DEVICE_ALIAS" '
/Name:/ {name=$2}
/device.alias =/ {
gsub(/"/, "", $3)
if ($3 == alias) {
print name
exit
}
}
')
if [ -z "$CARD_NAME" ]; then
echo "β Could not find Bluetooth device with alias '$DEVICE_ALIAS'"
exit 1
fi
# Available profiles and their descriptions
declare -A PROFILES=(
["a2dp-sink"]="High Quality Audio (No Mic)"
["headset-head-unit-msbc"]="Medium Quality Audio + Mic (mSBC)"
)
# Display current profile
CURRENT_PROFILE=$(pactl list cards | awk -v card="$CARD_NAME" '
$0 ~ "Name: "card {in_card=1}
in_card && /Active Profile:/ {print $3; exit}
')
echo "π§ Device: $DEVICE_ALIAS"
echo "π Current Profile: $CURRENT_PROFILE (${PROFILES[$CURRENT_PROFILE]:-Unknown})"
echo
echo "π Select a profile to switch to:"
# Present profile options
PS3="Enter your choice: "
select profile_key in "${!PROFILES[@]}"; do
if [[ -n "$profile_key" ]]; then
echo "π Switching to: $profile_key (${PROFILES[$profile_key]})"
pactl set-card-profile "$CARD_NAME" "$profile_key"
echo "β
Switched."
break
else
echo "β Invalid selection. Try again."
fi
done
Last active
May 19, 2025 09:04
-
-
Save ClimenteA/f081965893cd1eb4bb2ef8c8b42cab1c to your computer and use it in GitHub Desktop.
Sony SRS-XB100 - Ubuntu Microphone Setup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment