Skip to content

Instantly share code, notes, and snippets.

@cmod
Created January 29, 2019 23:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmod/f92ac084d1ec90f75964c2f02ddde75f to your computer and use it in GitHub Desktop.
Save cmod/f92ac084d1ec90f75964c2f02ddde75f to your computer and use it in GitHub Desktop.
{
"BTTWidgetName" : "Airpods",
"BTTTriggerType" : 639,
"BTTTriggerTypeDescription" : "Apple Script Widget",
"BTTTriggerClass" : "BTTTriggerTypeTouchBar",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTEnabled2" : 1,
"BTTUUID" : "9E161F92-3C7B-44CA-B18A-0DB292717A51",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTAlternateModifierKeys" : 0,
"BTTOrder" : 7,
"BTTDisplayOrder" : 0,
"BTTMergeIntoTouchBarGroups" : 0,
"BTTTriggerConfig" : {
"BTTScriptType" : 0,
"BTTTouchBarButtonColor" : "0.000000, 0.000000, 0.000000, 255.000000",
"BTTTBName" : "Airpods",
"BTTTouchBarItemIconWidth" : 22,
"BTTTouchBarItemPlacement" : 2,
"BTTTouchBarAlternateBackgroundColor" : "128.829533, 128.829533, 128.829533, 255.000000",
"BTTTouchBarScriptUpdateInterval" : 10,
"BTTTouchBarAlwaysShowButton" : "0",
"BTTTouchBarAppleScriptString" : "return do shell script \"OUTPUT=''; BLUETOOTH_DEFAULTS=$(defaults read \/Library\/Preferences\/com.apple.Bluetooth); SYSTEM_PROFILER=$(system_profiler SPBluetoothDataType); MAC_ADDR=$(grep -b2 \\\"Minor Type: Headphones\\\"<<<\\\"${SYSTEM_PROFILER}\\\"|awk '\/Address\/{print $3}'); CONNECTED=$(grep -ia6 \\\"${MAC_ADDR}\\\"<<<\\\"${SYSTEM_PROFILER}\\\"|awk '\/Connected: Yes\/{print 1}'); BLUETOOTH_DATA=$(grep -ia6 '\\\"'\\\"${MAC_ADDR}\\\"'\\\"'<<<\\\"${BLUETOOTH_DEFAULTS}\\\"); BATTERY_LEVELS=(\\\"BatteryPercentCombined\\\" \\\"HeadsetBattery\\\" \\\"BatteryPercentSingle\\\" \\\"BatteryPercentCase\\\" \\\"BatteryPercentLeft\\\" \\\"BatteryPercentRight\\\"); if [[ \\\"${CONNECTED}\\\" ]]; then for I in \\\"${BATTERY_LEVELS[@]}\\\"; do declare -x \\\"${I}\\\"=\\\"$(awk -v pat=\\\"${I}\\\" '$0~pat{gsub (\\\";\\\",\\\"\\\"); print $3 }'<<<\\\"${BLUETOOTH_DATA}\\\")\\\"; [[ ! -z \\\"${!I}\\\" ]] && OUTPUT=\\\"${OUTPUT} $(awk '\/BatteryPercent\/{print substr($0,15,1)\\\": \\\"}'<<<\\\"${I}\\\")${!I}%\\\"; done; printf \\\"%s\\\\n\\\" \\\"${OUTPUT}\\\"; else printf \\\"%s\\\\n\\\" \\\"${OUTPUT}\\\"; fi\" # Version 2.3",
"BTTTouchBarAppleScriptStringRunOnInit" : 0,
"BTTTouchBarOnlyShowIcon" : 0,
"BTTTouchBarFreeSpaceAfterButton" : "5.000000",
"BTTTouchBarAppleScriptUsePath" : 0,
"BTTTouchBarItemIconHeight" : 22,
"BTTTouchBarItemPadding" : 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment