Bluetooth autoconnection problem on Pop OS/Ubuntu

Step 1

Open a text editor and populate it with below script and save it /home/username/connect_myairpods.sh
Dont forget to update the 'username'.
Find MAC-address of the bluetooth device from the bluetooth settings (when connected to PC).

#!/usr/bin/bash
bluetoothctl trust MAC-address
bluetoothctl disconnect MAC-address
bluetoothctl connect MAC-address

Go to location of the script in terminal and run:
chmod +x connect_myairpods.sh

Step 2

Make desktop file and save it at /usr/share/application/myairpods.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name[en_US]= my airpods
Icon=/path/to/your/icon.png
Exec=/home/username/connect_myairpods.sh
Comment[en_US]=connect bt speaker

Go to location of the desktop file and run:
chmod +x myairpods.desktop

Close the terminal. An icon called 'my airpods' will be present in your applications. (Restart your pc if icon is not present). Just click on the icon to connect to your bluetooth device.