Cumulus MX Customizations for a Touch Bar MacBook Pro
Posted: Mon 27 Aug 2018 7:39 am
I've been playing with touch bar customizations using BetterTouchTool on my new MacBook Pro to try and make it more useful for me, and I've come up with a Cumulus MX powered one I really like.
First, I set up a macOS Launch Agent to automatically query the CMX webserver API (e.g. weather-server.local:8998/api/data/currentdata) every minute and write the result to ~/.pws. It first tries via the Bonjour address then falls back to my actual external IP; this should ensure that if I'm on my local network I'm not leaving it just to hit the computer on the other side of the house, but should get the data when I'm out and about on other networks.
The 4 different states of the Touch Bar when using my CMX-powered customizations
Then, I've then set up a bunch of BTT widgets to show current conditions. These widgets utilize simple applescripts to load the locally saved data from the CMX API, then extract the information using JSON Helper which adds straightforward JSON parsing functionality to AppleScript. Each button is set up to open another button group, which I've populated with more detailed information about that parameter. Additionally, for the main 3 condition overview buttons, I've configured RegEx matching to give them highlight appearances whenever the parameter exceeds a threshold value.
It's all a bit frivolous, but as a weather nerd (I'm actually a meteorologist by trade), it's undeniably cool having live-updating weather conditions from my PWS on my keyboard. Either way, I thought that maybe it'd be worth sharing as a "non-standard" application of Cumulus MX's features!
First, I set up a macOS Launch Agent to automatically query the CMX webserver API (e.g. weather-server.local:8998/api/data/currentdata) every minute and write the result to ~/.pws. It first tries via the Bonjour address then falls back to my actual external IP; this should ensure that if I'm on my local network I'm not leaving it just to hit the computer on the other side of the house, but should get the data when I'm out and about on other networks.
The 4 different states of the Touch Bar when using my CMX-powered customizations
Then, I've then set up a bunch of BTT widgets to show current conditions. These widgets utilize simple applescripts to load the locally saved data from the CMX API, then extract the information using JSON Helper which adds straightforward JSON parsing functionality to AppleScript. Each button is set up to open another button group, which I've populated with more detailed information about that parameter. Additionally, for the main 3 condition overview buttons, I've configured RegEx matching to give them highlight appearances whenever the parameter exceeds a threshold value.
It's all a bit frivolous, but as a weather nerd (I'm actually a meteorologist by trade), it's undeniably cool having live-updating weather conditions from my PWS on my keyboard. Either way, I thought that maybe it'd be worth sharing as a "non-standard" application of Cumulus MX's features!