Link Search Menu Expand Document

Creating a Bunch Status Board in Your Touch Bar

Buttons in Touch Bar

I’ve created a BetterTouchTool-Widgets script which can generate all of the Bunch widgets in your Touch Bar, get their UUIDs for updating, and handle refreshing the widgets. To use the script with Bunch:

  1. Install the script according to the README.
  2. Run btt_stats.rb add touch bunch.
  3. Select the new group in BTT configuration. If it was open at the time you ran the script, you’ll need to switch to a different screen (e.g. Keyboard) and back to Touch Bar to see the new group.
  4. Right click and choose “Copy” to copy the group’s data to the clipboard.
  5. Run btt_stats.rb uuids to get a configuration block for the group data in the clipboard.
  6. Add the configuration block to ~/.config/bttstats.yml, merging with any existing keys in the :refresh: section.
  7. Add (or update) a folder.frontmatter file in your Bunch folder with the following keys:

     run after: /path/to/btt_stats.rb refresh "bunch:${basename}"
     run after close: /path/to/btt_stats.rb refresh "bunch:${basename}"

The above scripts make use of the built-in frontmatter key basename, which returns the actual filename of your Bunch, ignoring any display title settings. The keys that the script creates based on the AppleScript response to tell app "Bunch" to list bunches will match the value of basename key for whatever Bunch is calling it.

Note that this method applies the run after: scripts to every Bunch in the folder. If you’re using run after: scripts in any of your individual Bunches, you’ll need to append this script after the existing ones in Bunches containing that key, as that will override the setting in folder.frontmatter. You can run multiple scripts by separating with a comma:

run after:, /path/to/btt_stats.rb refresh "bunch:${basename}"
run after close:, /path/to/btt_stats.rb refresh "bunch:${basename}"

Now whenever a Bunch opens or closes, its associated Touch Bar button will be updated with its state. The script to handle checking state is created and linked automatically when running btt_stats.rb add touch bunch.