Ok, one more batch of updates for Bunch. It’s just so much fun to work on that I spent last weekend on it. Don’t worry, nvUltra is getting an equal amount of love.

By the way, if you want to keep tabs on all of my latest work, apps, and special discounts, I formally invite you to subscribe to my new email list. It’ll be low-traffic and a great way for me to let you know about the important stuff.

Anyway, Bunch…

New docs

The single-page documentation was getting way out of hand, so I built a mini-site (using Jekyll and just-the-docs), now located at brettterpstra.com/bunch. All of the docs have been broken up into sections with full search, and an updated Quick Reference with input from Stuart Hertzog.

New features

Over the weekend I added a few new features that I think are really useful. This is all in addition to last week’s Do Not Disturb for Big Sur, AppleScript process text command, and interactive snippets.

Snippet URL Method

There’s now a URL method for running snippets. This is different from raw text handling or Bunch handling because it allows easy access to fragments and use of variables. If you have a snippet set up with sections and variables, you can easily run it from a URL using a link like:

x-bunch://snippet?file=MySnippets.snippet&fragment=Music&playlist=...

That loads the MySnippets file, locates the Music section, and fills in the ${playlist} variable. This opens up a lot of clever integration options!

See the URL handler docs for more details.

Snippet AppleScript Command

To match the snippet URL method, there’s a new AppleScript command: run snippet. It takes the same parameters, and variables can be passed as a URL query string.

tell application "Bunch"
	run snippet "MySnippets.snippet" fragment "Music" with variables "playlist=..."
end tell

Variable strings key=value pairs separated by ampersands. If you need to use an actual ampersand in the value, the contents are url decoded so you can just replace it with %26.

Side note: I wanted to make with variables accept an AppleScript record format, e.g. {playlist: "..."}, but coercing a record with arbitrary keys into an NSDictionary is, as far as I can tell, impossible. So we get URL query strings…

More in the Bunch AppleScript docs.

Variable Defaults

You can now specify default values for variables in snippets. Also, if you include variables in a snippet and then don’t pass a value, Bunch just removes the snippet placeholder and attempts to process without it, rather than, well, crashing.

To add a default value, use something akin to Bash variable formatting: ${variable:default}. If no variable with a matching key name is passed when importing the snippet, the default value (everything after the colon) will be used instead.

Startup Files

If you want to have one or more Bunches launch automatically when the application loads, you can now create *.startup files in your Bunch folder. These just contain a list of Bunches, one per line. Any file with the .startup extension will be automatically loaded when the app is launched.

This is handy if you have a set of login items that you always want run, but you want them run as a Bunch that can be quit. It also allows the use of Bunch commands on startup. Just add Bunch to your login items, then move any apps you want to from login items into a startup Bunch.

Launch Bunches Like Apps

You can now put the name of a Bunch on its own line in a Bunch to have it launch the same as any application. Unlike snippets (which can also be used to load Bunch contents) a Bunch launched this way gets registered as open in the menu, meaning you can close it separately from the calling Bunch.

You can easily use this within a snippet to allow interactive launching of Bunches with the new Optional Snippets feature.

General Bugfixes

In the process of working more extensively with snippets, fragments, and variables I found some issues that needed fixing. See the changelog for details.

Supporting Development

This is obviously taking up a fair amount of my time these days, but I’ve received enough feedback that I know a lot of people are finding it very useful. If you’re among them, please consider a donation to support further development. A huge thanks to everyone who’s already pitched in!

So check out the new site, which includes download and install instructions!