Created
April 13, 2021 13:48
-
-
Save teppeis/ea73d55ed288ff72cc5c2acf6b9d9ff9 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
# derived from https://yoshiori.hatenablog.com/entry/2021/04/13/171405 | |
AIR_PODS_ADDRESS="aa-aa-aa-aa-aa-aa" | |
AIR_PODS_NAME="XXX AirPods Pro" | |
/usr/local/bin/bluetoothconnector -c $AIR_PODS_ADDRESS | |
for ((i=0 ; i<10 ; i++)) | |
do | |
if [ "Connected" == "$(/usr/local/bin/bluetoothconnector -s $AIR_PODS_ADDRESS)" ]; then | |
# sleep 0.5 | |
/usr/local/bin/SwitchAudioSource -s "$AIR_PODS_NAME" | |
sleep 0.5 | |
afplay /System/Library/Sounds/Hero.aiff | |
say -v samantha Connected | |
break | |
else | |
echo "Not connected" | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment