Skip to content

Instantly share code, notes, and snippets.

@aymenkrifa
Created December 21, 2023 20:14
Show Gist options
  • Save aymenkrifa/7e76c63a41501659b863bb1d74485153 to your computer and use it in GitHub Desktop.
Save aymenkrifa/7e76c63a41501659b863bb1d74485153 to your computer and use it in GitHub Desktop.
Shell script for AirPods connect in Ubuntu system
#!/bin/bash
MAC_ADDRESS="XX:XX:XX:XX:XX:XX" # Replace with your AirPods' MAC address
# Check if AirPods are already connected
if bluetoothctl info $MAC_ADDRESS | grep -q "Connected: yes"; then
notify-send "AirPods are already connected."
else
# Connect to AirPods
bluetoothctl connect $MAC_ADDRESS
notify-send "Connecting to AirPods..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment