[Sharing] One preset for ALL Apple wireless headphones (update to v1.1.1)

Cool preset, it works - connects and disconnects my AirPods. But on the touchbar I get only this:

We're on it :wink:

Hi brayozz,

Line 77 is main() function, but I need to know the entire traceback info, can you show me the complete error message of this widget in BTT after clicking run script?

And, what macOS are you using?

@Caliguvara @brayozz Please try the preset I just fixed, it should be working now~

1 Like

It does :wink: Thanks!!

1 Like

hmm, me again, no icons, works kind of - weird

Hi tosbsas,

What version of macOS are you using? Mojave and below doesn’t have python3 natively, and no icons for products released later than the OS.

You can run the trigger in the BTT and attach the screenshot here.

!

Only get switching Text, no AirPodPro icons

Catalina latest update

It looks like there is a space in AirPods Pro in the scripts but not in the device name

yep was there, fixed it. Still no icons

Hi tosbsas,

Thanks for your screenshots, the message Error/Nothing was returned is ambiguous, it seems like the error is not from the python script, there are two reasons:

  1. This script should return some information if it runs, so it's not likely to return nothing.
  2. If any error occurs which my script is not well-handled, python will raise the error like the image below.
    image

I guess the script is not even running, besides, I am able to reproduce your error when I change the python path in this text box to some non-existing path:
image
Thus, I highly recommend you to run which python3 in the terminal, and paste the result to the text box I show you.

If the method above is not working, download the script below (the content is the python code in my preset) and change the extension to .py, launch terminal and type python3 and a space, then drag the file to the terminal window and see if anything is returned.
Untitled.js (3.8 KB)
If any error occurs, pls inform me.

you nailed it, python3 in my case was at /usr/bin/python3

Got the icons now. Only thing left - what would be the NC color code for black as I have all my icons with black bg

Hi @jrosenkrantz,

I saw your request in another post that you want to hide the icon when the device is not connected, simply add this line of code
if not connected: return ""
in here:

It should do the trick.

Thank you Noon_Chen.. this worked brilliantly!
It's a beautiful widget you created

1 Like

Glad to hear the problem is solved.

What color do you want to change? The background color of the button or the color of the text?

BG color can be changed here:
image

If you'd like to change the font color, add/modify the code here:

The color value should be "R,G,B,A", representing Red, Green, Blue and Alpha (opaqueness), white would be "255,255,255,255", black would be "0,0,0,255"

I get an error message when putting
0,0,0,255

ile "", line 6
disconnectedBGColor = “0,0,0,255"
^
SyntaxError: invalid character in identifier

“” is the source of the issue, replace them to ""

whow, found it - wierd, never changed that "

In System Prefs, go to Keyboard. Change the quote style on the right to avoid this when working with codes and scripts.

understand, I actually never touched those, but not sure I'll change that setting as in German they look like this