https://github.com/araa47/MacbookProTouchBar-Crypto-Ticker
Customise your macbook pro touchbar into a cryptocurrency ticker
https://github.com/araa47/MacbookProTouchBar-Crypto-Ticker
bettertouchtool coinmarketcap macbook touchbar
Last synced: 6 months ago
JSON representation
Customise your macbook pro touchbar into a cryptocurrency ticker
- Host: GitHub
- URL: https://github.com/araa47/MacbookProTouchBar-Crypto-Ticker
- Owner: araa47
- Created: 2018-07-26T08:53:31.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-26T08:54:26.000Z (about 7 years ago)
- Last Synced: 2025-04-03T14:21:56.509Z (6 months ago)
- Topics: bettertouchtool, coinmarketcap, macbook, touchbar
- Language: AppleScript
- Size: 3.32 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Macbook Pro Touchbar Crytpo Ticker
## Introduction
The following program is a simple guide that uses BetterTouchTool to display crypto currency prices on your macbook touchbar. The end result will look something like the image below.

## What you will need
You will need a macbook with touchbar and you will also need BetterTouchTool installed which you can find over here https://folivora.ai/
## Getting Started
1) Install better touch tool
2) Install json-helper to make scripting easier, https://itunes.apple.com/dk/app/json-helper-for-applescript/id453114608?mt=12
3) Click the touchbar tab on BTT
4) Click on the +Widget button
5) In the Select Widget drop down select Run Apple Script and Show Value, and click on Advanced configuration
6) Name the widget , for our first one we can call it "BTC"
7) Copy paste the following code
```
set mJson to do shell script "curl -s 'https://api.coinmarketcap.com/v1/ticker/bitcoin/'"
set AppleScript's text item delimiters to {","}
set keyValueList to (every text item in mJson) as list
set AppleScript's text item delimiters to ""set theKeyValuePair to item 5 of keyValueList
set AppleScript's text item delimiters to {": "}
set theKeyValueBufferList to (every text item in theKeyValuePair) as list
set AppleScript's text item delimiters to ""
set usdPrice to item 2 of theKeyValueBufferList
set usdPrice to text 2 thru -2 of usdPrice
set usdPrice to round (usdPrice)
return "$" & usdPrice
```The above script simply calls the coinmarketcap api url endpoint for bitcoin and then parses the usdPrice value and rounds this value. You can look at the files inside the AppleScript folder for more examples.
8) Save
9) Now you can work on adding a cool logo. I found my logo's by going to coinmarketcap and downloading each coins logo
10) You can now simply add the logo by clicking on the logo option in BTT and dragging the corresponding image file.
11) Now if you want to define an action when you click on the touchbar for this coin, you can simply define an action. I wanted mine to load up coinmarketcap bitcoin page, so i choose "run apple script (async in background)" in the "predfined action" section.
12) Now I copy paste the following code to tell chrome to open the corresponding website.
```
tell application "Google Chrome"
if it is running then
open location "https://coinmarketcap.com/"
else
activate
open location "https://coinmarketcap.com/"
delay 1
activate
end if
end tell
```13) Next I repeated steps 4-12 for all the other coins I wanted to track by simply chaning the url on the applescript to the corresponding coin I wanted to track.
12) You are ready to go, you should have a crypto ticker active on your touchbar