Link Search Menu Expand Document

Opening Other Bunches

You can launch other Bunches just by adding the full name of the Bunch, including the “.bunch” extension, on a line, just like you would an app. Bunches launched in this manner behave as if you clicked them in the menu: it gets an “open” checkbox in the menu, and can be quit separately from the Bunch that launched it.

# Open the Comms Bunch as if we had clicked it in the menu.
Comms.bunch

You can use this in optional snippets to make entire Bunches optional. Create a snippet that calls a Bunch, then reference it with optional syntax.

Example:

<mysnippet.snippet ?"Launch the Bunch in this snippet?"

When closing the parent Bunch, any Bunches launched will also be closed. Use %Name.bunch to ignore the Bunch when closing.

Closing Other Bunches and Launch on Close

Bunch lines behave just like app lines, so using !Name.bunch will quit that Bunch, and using !!Name.bunch will launch that Bunch when the containing Bunch closes.

If a Bunch quits another Bunch when it launches (!Name.bunch), the Bunch that was closed will be re-opened when the containing Bunch closes.

If a Bunch is closed that contains apps launched by the parent Bunch, those apps won’t be quit when closing the Bunch. Same goes in the other direction: if opening a Bunch would launch apps that the containing Bunch would quit, those apps are ignored and left running.

Nesting

You can nest these calls, having one Bunch open another which opens another, but you can’t open or close a Bunch that appears earlier in the chain. This is to avoid infinite loops.

Beware of having a Bunch close or launch other Bunches that also close or launch Bunches. Bunch has safeguards against loops, but if you get crazy enough, it’s turtles all the way down.

Launching Bunches as snippets

You can also use any Bunch file as a snippet. This will incorporate the contents of the Bunch (or any fragment within it) directly into the calling Bunch, starting and quitting items when the calling Bunch opens and closes. In this case the Bunch in the menu does not get a checkmark, it’s contents are now part of the Bunch you called it from.

It does have the benefit of directly using things like optional snippets and delays.

Example:

# Launch the Work fragment of Comms.bunch 
# after a 30-second delay
<Comms.bunch#Work ~30

# Ask if we should load the Social fragment
<Comms.bunch#Social ?"Is Social Media a good idea right now?"