Jump to content

AirPod Connector


Recommended Posts

14 hours ago, Acidham said:

 

Thanks,

 

Tested and it seems like it works to use and connect with. However, once connected i cannot disconnect using the same command.

And when i run 'airpd' while connected it says 'Airpods pro are NOT connected' even though they are.

 

 

Link to comment
  • 1 year later...

June 2023, is this still working for everyone? It seems if my AirPods pro (2nd gen) are connected to my phone and i want to switch to MacBook air it does not work and i have to manually go into bluetooth setting still....just wondering if anyone else is experiencing this 

Link to comment
  • 6 months later...
  • 5 months later...
Posted (edited)

Hey, @Acidham.

 

First, thank you for making this workflow. I have submitted pull requests to this workflow and have been a daily user of it since then. I wonder how it performs recently for you because I have issues where it is slow or just straight up doesn't connect/disconnect. 

 

I added some debug info in the con_manager.py script and found out that the problem is probably the 'os.popen()' lines. They do not give an error, but they don't seem to do anything. If I pass on the f'{blueutil} --connect {adr}' command to a Terminal Command object, things would work, actually work a lot better. It usually takes about 5-6 seconds to connect to my AirPods, but in this fashion it takes 2 seconds, tops. 

 

#!/usr/bin/python3

import os
import shutil
import sys

from Alfred3 import Tools

query = Tools.getArgv(1)
adr, switch = tuple(query.split(";"))
Tools.log(adr)
Tools.log(switch)

blueutil = shutil.which('blueutil')
Tools.log(blueutil)

if blueutil:
    if switch == "disconnected":
        Tools.log("1")
        Tools.log(adr)
        cmd = f'{blueutil} --connect {adr}'
        Tools.log(cmd)
        sys.stdout.write(cmd)
        # os.popen(cmd)
    else:
        Tools.log("2")
        cmd = f'{blueutil} --disconnect {adr}'
        Tools.log(cmd)
        sys.stdout.write(cmd)
        # os.popen(cmd)
        
Tools.log("Finished")

image.thumb.png.2d5d123808ddf7905e8ecf101ac84ec1.png

image.thumb.png.1b2bf56a1c45020add75b784dc1a0deb.png

 

Does anyone have an insight into why Python's 'os.popen()' is much slower and could stop working? 

 

I have tried to pass the "/opt/homebrew/bin/blueutil --disconnect AA:AA:AA:AA:AA:AA"-like command into a Run Script object like this:

 

image.thumb.png.caa32d9709769fe7faf49a607c1b1012.png

 

Except it did not work. So I chose the Terminal Command object. I would like to know why that happens too…

 

Also, I wonder what the --wait-disconnect option in your script intended to do?

I'm using macOS 14.5, Alfred 5.5 [2257], AirPods Pro (2nd gen with USB-C case), blueutil 2.10.0.

Edited by spongeblink
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...