While working to create a complete redesign of the Touch Bar I came to the dismaying realization that there is no "one-solution-for-all" for easy access to critical system information. With this realization in mind I decided to build a very simple Python project that allows the user to easily pull system information without much hassle within BetterTouchTool.
The project is mainly a wrapper for
iStats, but once installed it makes the life of anyone trying to display system information in the Touch Bar extremely easy. The project is called
Tocco, and you can view its source code directly here. With Tocco, you can pull the following information with easy:
import tocco # Battery print(tocco.battery.percent) print(tocco.battery.hours_left) # CPU print(tocco.cpu.percent) print(tocco.cpu.temperature.C) print(tocco.cpu.temperature.F) # GPU print(tocco.gpu.temperature.C) print(tocco.gpu.temperature.F) # Fan print(tocco.fans.rpm) # Disk print(tocco.disk.total) print(tocco.disk.used) print(tocco.disk.free) print(tocco.disk.percent) # Memory print(tocco.memory.total) print(tocco.memory.available) print(tocco.memory.used) print(tocco.memory.free) print(tocco.memory.active) print(tocco.memory.inactive) print(tocco.memory.wired) print(tocco.memory.percent) # Network print(tocco.network.sent_last_sec) print(tocco.network.received_last_sec)
Tocco you may either do so via the express installation here or by doing the following:
- Install iStats via gem,
sudo gem install iStats
- Install Brew via brew.sh
- Install Python3 via brew,
brew install python3
- Install Tocco via Python3,
/usr/local/bin/python3 -m pip install git+http://github.com/synchronizing/Tocco
After proper installation (detailed below) you are a step away from adding any of the above to your Touch Bar; simply add a "Shell Script/Task Widget" and use the following script with your own designated refresh rate:
/usr/local/bin/python3 -c "import tocco; print(tocco.battery.hours_left)"
Simple as that. Your widget will now refresh with information every second! I recommend to be mindful of the refresh rate and only put low refresh time in utilities that are worthy (CPU percent, memory usage, etc) -- stuff like battery percent does not need a 1 second refresh rate.