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

**URL:** <https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826>\
**Category:** Setup/Preset Sharing\
**Tags:** applescript, python, touch-bar\
**Created:** [May 4, 2020, 9:18am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826 "2020-05-04T09:18:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [May 4, 2020, 9:18am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/1 "2020-05-04T09:18:30Z")

</div>

_Github repo: [GitHub - noonchen/BTT\_AppleWirelessHeadphone: Toggle and display battery info of apple wireless headphones on the touch bar](https://github.com/noonchen/BTT_AppleWirelessHeadphone)_

This preset shows the icon and battery info of your Apple wireless headphones on the touch bar, it will support **ALL** apple headphones and furture modes, such as AirPods (Pro), BestsX, etc, as long as your macOS is up to date.

_ **Note:** Current for macos Catalina only, because Mojave and below do not have python3 installed and not image for AirPods Pro, I'd use python2 to rewrite the code sometime later._

## Functionality

You can use this preset to toggle up to 2 headphones.  
**v1.0:**

- _ **Tap** _ to toggle headphone #1
- _ **Long press** _ to toggle headphone #2

**v1.1:**

- _ **Tap** _ to [toggle or switch](https://github.com/noonchen/BTAudioSwitch#readme) to headphone #1
- _ **Long press** _ to [toggle or switch](https://github.com/noonchen/BTAudioSwitch#readme) to headphone #2

**Display demonstration:**

| Model | Off | On | On  
(one pod in case) |
| --- | --- | --- | --- |
| AirPods Pro | ![](https://community.folivora.ai/uploads/default/original/2X/4/41e645d9225b8a915bb520bd00765506433d00c5.png) | ![](https://community.folivora.ai/uploads/default/original/2X/4/4abfe64084d22f372b31a5871aacfcef11644d99.png) | ![](https://community.folivora.ai/uploads/default/original/2X/b/b6857372ca6a2ed3aae2d8860284ba8b3af103d6.png) |
| BeatsX | ![](https://community.folivora.ai/uploads/default/original/2X/2/2c7f9927cbd0e257d33e917b8ccc4a00d78ee73f.png) | ![](https://community.folivora.ai/uploads/default/original/2X/c/c73b2127891e0fccd9b2e7ce6972808423dd2e4b.png) | - |

## Setup

_Ensure that your headphone(s) appears on the Bluetooth panel of System Preferences._

1. Download and double click `AppleHeadphone.bttpreset` to import it into BTT

2. Go to **Touch Bar** section (⌘+1), click on the `shell script/Tasks` widget and change `Launch Path` to the output of `which python3` in Terminal.  
 ![](https://community.folivora.ai/uploads/default/original/2X/6/650cc51f193b67ed41b58c404d7ebccbd9dd2a91.png)  

3. Go to **Named & Other Trigger** section (⌘+9), find and expand the following triggers, Toggle...#1 is activated by tapping, and Toggle...#2 is by long pressing.  

**v1.0:**

- Then click on Action 2 and choose your device accordingly.

## Download

~~[AppleHeadphone.bttpreset](https://community.folivora.ai/uploads/short-url/nkpwZDS8Hf8cFGB8irk2hrSP9TD.bttpreset) (10.0 KB)  
 [AppleHeadphone\_v1\_0.bttpreset](https://github.com/noonchen/BTT_AppleWirelessHeadphone/releases/tag/v1.0) (Bug fixed)  
 [AppleHeadphone\_v1\_1.bttpreset](https://github.com/noonchen/BTT_AppleWirelessHeadphone/releases/tag/v1.1) (Embed [BTAudioSwitch](https://github.com/noonchen/BTAudioSwitch))~~  
[AppleHeadphone\_v1\_1\_1.bttpreset](https://github.com/noonchen/BTT_AppleWirelessHeadphone/releases/tag/v1.1.1) (Embed [BTAudioSwitch](https://github.com/noonchen/BTAudioSwitch), see change log in Github)

Thanks @Caliguvara for the inspiration!  
For any issues/suggestions, please leave it in the comments or post an issue on Github. 😉  
If you like this preset, support me by: [paypal.me/noonchen](http://paypal.me/noonchen)

---

<div class="post-metadata">

**Author:** ![Caliguvara](https://community.folivora.ai/user_avatar/community.folivora.ai/caliguvara/32/42570_2.png) [@Caliguvara](https://community.folivora.ai/u/Caliguvara)\
**Post date:** [May 4, 2020, 11:30am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/2 "2020-05-04T11:30:17Z")

</div>

Nice to see what you have done here 😃 I might actually end up understand some basics of shell in order to adapt this to fit my Touch Bar Design 😃 Thanks a lot for the work you did here!

---

<div class="post-metadata">

**Author:** ![brayozz](https://community.folivora.ai/user_avatar/community.folivora.ai/brayozz/32/25279_2.png) [@brayozz](https://community.folivora.ai/u/brayozz)\
**Post date:** [May 5, 2020, 4:13pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/3 "2020-05-05T16:13:34Z")

</div>

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

 ![Touch Bar Shot 2020-05-05 at 18.12.37](https://community.folivora.ai/uploads/default/original/2X/6/64061b4e147ae2c44c378295656136c7fce58b87.png)

---

<div class="post-metadata">

**Author:** ![Caliguvara](https://community.folivora.ai/user_avatar/community.folivora.ai/caliguvara/32/42570_2.png) [@Caliguvara](https://community.folivora.ai/u/Caliguvara)\
**Post date:** [May 5, 2020, 4:16pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/4 "2020-05-05T16:16:37Z")

</div>

We're on it 😉

---

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [May 5, 2020, 10:50pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/5 "2020-05-05T22:50:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [May 6, 2020, 10:08am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/6 "2020-05-06T10:08:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Caliguvara](https://community.folivora.ai/user_avatar/community.folivora.ai/caliguvara/32/42570_2.png) [@Caliguvara](https://community.folivora.ai/u/Caliguvara)\
**Post date:** [May 6, 2020, 10:18am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/7 "2020-05-06T10:18:47Z")

</div>

It does 😉 Thanks!!

---

<div class="post-metadata">

**Author:** ![tosbsas](https://community.folivora.ai/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@tosbsas](https://community.folivora.ai/u/tosbsas)\
**Post date:** [June 23, 2020, 9:34pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/8 "2020-06-23T21:34:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [June 24, 2020, 12:35am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/9 "2020-06-24T00:35:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tosbsas](https://community.folivora.ai/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@tosbsas](https://community.folivora.ai/u/tosbsas)\
**Post date:** [June 24, 2020, 1:34am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/10 "2020-06-24T01:34:48Z")

</div>

![Bildschirmfoto 2020-06-23 um 20.24.15](https://community.folivora.ai/uploads/default/original/2X/c/cee8f7a2a498d1f701e83772a892683d79e291f1.jpeg) ![Bildschirmfoto 2020-06-23 um 20.23.26](https://community.folivora.ai/uploads/default/original/2X/2/2cc907939767dd87bbfc3791820457bef4eb9548.jpeg) ![Bildschirmfoto 2020-06-23 um 20.23.10](https://community.folivora.ai/uploads/default/original/2X/6/6aeda913f933272e46d94e39ce258bff5ab84268.jpeg) ![Bildschirmfoto 2020-06-23 um 20.22.37](https://community.folivora.ai/uploads/default/original/2X/3/3dbd8af2c10414f3470fe15f28da4a542541e430.jpeg) !

Only get switching Text, no AirPodPro icons

Catalina latest update

---

<div class="post-metadata">

**Author:** ![jrosenkrantz](https://community.folivora.ai/user_avatar/community.folivora.ai/jrosenkrantz/32/32524_2.png) [@jrosenkrantz](https://community.folivora.ai/u/jrosenkrantz)\
**Post date:** [June 24, 2020, 2:20am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/11 "2020-06-24T02:20:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tosbsas](https://community.folivora.ai/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@tosbsas](https://community.folivora.ai/u/tosbsas)\
**Post date:** [June 24, 2020, 2:29am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/12 "2020-06-24T02:29:33Z")

</div>

yep was there, fixed it. Still no icons

---

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [June 24, 2020, 1:12pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/13 "2020-06-24T13:12:46Z")

</div>

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](https://community.folivora.ai/uploads/default/original/2X/3/3ce138f2f777308f51d6ec15ec1402ae79e88dab.png)

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](https://community.folivora.ai/uploads/default/original/2X/2/24c3ec75087104f860df8a4bb11e0e38c1568b0e.png)  
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](https://community.folivora.ai/uploads/short-url/bvk6InBZFPq4nncxHXlSR251Akj.js) (3.8 KB)  
If any error occurs, pls inform me.

---

<div class="post-metadata">

**Author:** ![tosbsas](https://community.folivora.ai/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@tosbsas](https://community.folivora.ai/u/tosbsas)\
**Post date:** [June 24, 2020, 1:29pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/14 "2020-06-24T13:29:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [June 24, 2020, 1:36pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/15 "2020-06-24T13:36:18Z")

</div>

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:

 ![image](https://community.folivora.ai/uploads/default/original/2X/b/bb7b8c563b2ae845a1dc1572ad3e26a405e45f64.png)

It should do the trick.

---

<div class="post-metadata">

**Author:** ![jrosenkrantz](https://community.folivora.ai/user_avatar/community.folivora.ai/jrosenkrantz/32/32524_2.png) [@jrosenkrantz](https://community.folivora.ai/u/jrosenkrantz)\
**Post date:** [June 25, 2020, 3:01am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/16 "2020-06-25T03:01:34Z")

</div>

Thank you Noon\_Chen.. this worked brilliantly!  
It's a beautiful widget you created

---

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [June 25, 2020, 8:34am UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/17 "2020-06-25T08:34:39Z")

</div>

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](https://community.folivora.ai/uploads/default/original/2X/5/534eb52d0638ffbd735a4d6ef5cfa3f50cd7ba84.png)

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

 ![image](https://community.folivora.ai/uploads/default/original/2X/d/d6490bec7f503a3b4d5b8bc5f1dbd88ef5b0e502.png)

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"`

---

<div class="post-metadata">

**Author:** ![tosbsas](https://community.folivora.ai/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@tosbsas](https://community.folivora.ai/u/tosbsas)\
**Post date:** [June 25, 2020, 1:14pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/18 "2020-06-25T13:14:44Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Noon\_Chen](https://community.folivora.ai/user_avatar/community.folivora.ai/noon_chen/32/10017_2.png) [@Noon\_Chen](https://community.folivora.ai/u/Noon_Chen)\
**Post date:** [June 25, 2020, 1:27pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/19 "2020-06-25T13:27:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tosbsas](https://community.folivora.ai/letter_avatar_proxy/v4/letter/t/db5fbb/32.png) [@tosbsas](https://community.folivora.ai/u/tosbsas)\
**Post date:** [June 25, 2020, 1:35pm UTC](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826/20 "2020-06-25T13:35:10Z")

</div>

whow, found it - wierd, never changed that "

[Next page](https://community.folivora.ai/t/sharing-one-preset-for-all-apple-wireless-headphones-update-to-v1-1-1/15826.md?page=2)
