Skip to content

Instantly share code, notes, and snippets.

@arjan
Created April 13, 2022 07:23
Show Gist options
  • Save arjan/8cd04a14a8b9f7267540b69d20f33e0d to your computer and use it in GitHub Desktop.
Save arjan/8cd04a14a8b9f7267540b69d20f33e0d to your computer and use it in GitHub Desktop.
Sony WH-1000X bluetooth profile switcher
#!/bin/bash
set -e
CARD=$(pactl list | grep bluez_card | awk -F ': ' '{print $2}')
A=a2dp-sink-ldac
B=headset-head-unit
PROFILE=$(pactl list |grep 'Active Profile' | tail -n 1 | awk -F': ' '{print $2}')
if [ "$PROFILE" = "$A" ]; then
TARGET=$B
else
TARGET=$A
fi
echo "$PROFILE -> $TARGET"
notify-send "Audio profile: $TARGET"
pactl set-card-profile "$CARD" "$TARGET"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment