Bunch

A Batch Application Launcher for your Dock

What Is Bunch?

Bunch is a little macOS app that sits in your Dock. It doesn’t have any windows. When you right/ctrl-click it, it gives you a list of “Bunches” you can select from, each one launching a group of applications that you configure. Bunches can be configured to open apps, specific files in an app, and even web pages in your default browser.

I wrote Bunch because I tend to launch a specific group of apps depending on the context I’m working in. These are apps I wouldn’t launch on login, and don’t need running all the time. I just wanted to make starting a new context into one click. I’d started with just making little Script Editor and Automator applets for it, but I found I wanted something easily configured with text files, quick to set up and easy to modify.

Sure, it could have been a menu bar application, but for whatever reason I wanted it in my Dock. I have no strong case for that either way.

As of Bunch 1.0.2+ can quit apps. So it serves as a type of context switcher, changing the set of apps and documents open. That said, I wrote it in an hour, so you get what you pay for. Bunch is free, but you can think of it as donationware if you like…

Yes, the icon is a bunch of grapes. I told you, I wrote this in an hour.

Installation

Just download the DMG and double click it to mount. Drag the Bunch icon to the Applications folder icon. You can then launch Bunch from your Applications folder. (Or with Spotlight. Or Launchbar. Or Alfred. Or…)

You’ll probably want Bunch to stay in your Dock for easy access, so go ahead and launch it once, right click the Dock icon and select Options->Keep In Dock. (Or just drag it to the left side of your Dock, next to Finder. It’s a great location for it, and that automatically keeps it in the Dock.)

Bunch doesn’t currently offer any option to install itself into your login items (“e.g. Launch on startup”), so if you want it to run automatically, open System Preferences->Users & Groups and add it to your login items.

The first time you run it, an example configuration will be written to your home folder. See the configuration section for instructions on personalizing the setup. Use “Reveal Bunches in Finder” to go directly to that folder and start editing/adding Bunches.

Setup/Configuration

See an example .bunch file.

By default, Bunch reads plain text files from a folder at ~/bunches (that’s a folder called “bunches” in the base of your Home folder). You can change the location of that folder using “Change Bunches Folder” from the Dock icon (possibly to a Dropbox or iCloud folder where you can sync with other machines).

Tip (kinda): when you change the Bunches folder location, it doesn’t move or delete any of the Bunches at the previous location. That means that (in a fairly inelegant way) you can use different folders for different sets of Bunches.

Each Bunch file has the extension .bunch, so a basic config file would look like ~/bunches/Example.bunch.

Each Bunch is a separate file, and the name of the Bunch will be taken from the filename (without the .bunch extension). Once you’ve added your own configuration(s), delete the Example.bunch file (or rename it with an extension other than .bunch).

Launching Apps

Within a Bunch file you simply list the apps you want to launch, one per line. For example, in “Comms.bunch”:

Messages
Slack
Mail
Twitter

Opening Files

You can additionally have an app open specific documents, if the app supports that. After the app name, simply add one or more documents on lines that begin with a dash. For example, to have Numbers open two specific spreadsheets:

Numbers
- ~/Documents/job 1.numbers
- ~/Documents/job 2.numbers

Paths to documents can use a tilde ~ to represent the home directory. Spaces are fine, no quotes or escaping needed.

Quitting Apps

Put an exclamation point before the app name to quit that app if it’s open. This works on apps that respond to the AppleScript “quit” command, which is most apps. For example, to quit Mail and launch MailMate instead:

!Mail
MailMate

Opening Web Pages/URL Schemes

If you want to open web pages as part of a Bunch, you can just put a URL at the beginning of a line (like you would an app) and that URL will be opened in your default browser. If the URL is a URL scheme for an installed app, it will be executed as if called from a link or via the open command.

* https://hulu.com
* https://brettterpstra.com
* x-marked://open?file=filename.md

“Focusing” an App

If you start an app line with an @ symbol, it will attempt to focus that app. This should be run as the last line of the file, after all other lines have run. Make sure the app you want to focus has already been launched.

OmniFocus
MultiMarkdown Composer
@OmniFocus

Everything is launched in the order listed in the Bunch file. Some apps take longer than others to launch or open a file, so execution will continue in the background after the inital launch of the app.

Running AppleScript

Put a * at the beginning of a line to have the line interpreted as AppleScript. There will be some permissions requests and some commands that just refuse to run, but try it out. You can open Console.app to see any errors that your command might run into. This feature is only marginally tested.

* say "Welcome to the communications context"
* do shell script "/bin/bash my_cli_tool.sh 
* tell app "System Events" to set autohide of dock preferences to true

Bunch Commands

Lines surrounded in parenthesis are Bunch commands. These offer shortcuts to some system tasks, currently “show dock” and “hide dock.”

(hide dock)
(show dock)

Hiding Apps

If you use “@@” alone on a line, Bunch will hide all visible apps. (Menu bar apps like Dash or TextExpander may not hide properly.) This is ideal for use at the very beginning of a Bunch, giving you a clean slate for a new set of apps.

You can also append an underscore after any single app name and Bunch will attempt to hide it after launching. (This can be flaky depending on how long the app takes to launch.)

Tips for a good Bunch

Only include apps that you only need for this context, not apps that launch at login or are generally always running. Including apps that you already have running anyway means that if you use any of the “quit” methods to close the bunch, you’ll be closing apps you would normally keep running.

For example, I only use Xcode when I’m in one of my coding projects. So for any project’s context, I include Xcode (and have it open that project’s file). In Single Context Mode, if I switch to another coding project, Xcode will stay open, but if I switch to a non-coding project from a coding project, Xcode will close.

iTerm, on the other hand, is always running. So I would never include it in a Bunch. No matter what context I switch to or quit, iTerm stays running.

Usage

Once you have one or more .bunch files in your ~/bunches folder, launch Bunch (or right click it and choose “Refresh Bunches”). Now when you right-click the icon, you’ll see all available Bunches listed at the top of the popup menu. Select one to launch, quit, or focus the apps as defined in that Bunch file.

If you enable “Toggle Bunches,” when a Bunch is launched, its menu item in the Dock menu receives a checkmark. Selecting a Bunch with an active checkmark will “toggle” the Bunch, quitting any apps it launched (if they’re running) and reversing any Dock commands.

If “Single Bunch Mode” is enabled, clicking a Bunch will quit apps in the previous Bunch before launching it.

Otherwise, clicking a Bunch will always launch the apps in the Bunch, or bring them to front if they’re already running.

In the Dock Menu

Quit Apps in…: You can quit the apps listed in any Bunch from this submenu. Files, scripts, and urls (as well as ! lines that already quit an app) are ignored. If the selected Bunch contains a dock command, it’s reversed.

Preferences->Toggle Bunches: When this is enabled, running bunches are shown with a checkmark in the menu, and clicking them again will quit apps contained in that bunch instead of relaunching them.

Preferences->Single Bunch Mode: Turning this on will cause the active Bunch to quit when launching a new Bunch. Any apps in the last Bunch that are not included in the new Bunch will be terminated, and any Bunch commands will be reversed unless the new Bunch contains a Bunch command of the same type (if the command affects the Dock and the new bunch command also affects the Dock, no action is taken).

Preferences->Refresh Bunches: You can use “Refresh Bunches” at any time to update the menu after editing your configutation files.

Preferences->Change Bunches Folder: Select a new folder where Bunch will look for .bunch files.

Preferences->Reveal Bunches in Finder: Opens the folder containing your .bunch configuration files (Bunches) in Finder for editing.

Help->Bunch Help: Opens this page in your browser.

Help->Changelog: Opens the full version history in your browser.

Help->Make a donation: Because it’s the right thing to do, in my opinion.

You can also refresh and reveal Bunches in Finder from the File menu, and check for updates and control preferences (Bunch location, Single Bunch Mode) from the Bunch menu.

URL Handler

Bunch has its own URL scheme that you can call from other apps and scripts. The full version of the URL is x-bunch://open?bunch=[BUNCH NAME]. The url can be shortened, though, to just the Bunch name: x-bunch://[BUNCH NAME].

The Bunch name is case insensitive, so “bunch name” works just as well as “Bunch Name.” Bunch does need to already be running in order to execute a bunch via the URL handler. You can always launch Bunch with open -a Bunch from a script, but you’ll need to give it time to initialize.

Tip: You can use simple shell scripts with apps like BetterTouchTool and Keyboard Maestro to assign bunches to hotkeys. If you have a cool programmable keypad, just imagine the possibilities…

Support

None, really, this is just a stupid early-morning project at this point. I’m happy to know about bugs you run into, and will do my best to find time to fix them, but no promises on prompt updates or anything.

Download

Bunch v1.0.7

A Batch app launcher for the macOS Dock

Updated Mon May 20 2019.

DonateMore info…

Roadmap

Some maybe items:

  • Menu bar option
  • Save as Bunch (save currently open apps as a Bunch)
  • Better monitoring of app launches for feedback display
  • Probably going to need a preference pane eventually
  • Ability to double click bunch files
  • Features to work with Alfred/Launchbar
  • Internal Bunch editor

Changelog

1.0.1
Remove cruft from app menus
Add “Show Bunches in Finder” to Dock and File menus
1.0.2
Improve launch speed
Allow ![app name] to quit an app
Build for older macOS versions
Sort Bunches alphabetically in Dock menu
1.0.3
Add @focus syntax
Add *AppleScript syntax
1.0.4
Allow URL schemes (in addition to http)
Test if app is running or hidden before launching, hiding, quitting
Use NSWorkspace instead of AppleScript where possible
Allow _ suffix to hide app (experimental)
1.0.5
New URL handler x-bunch:
Ability to change location of Bunches folder
1.0.6
@@ alone on a line will hide all apps
1.0.7
Toggle Bunches mode, checkmark opened Bunches, click checkmarked Bunch to quit
Single Bunch Mode
Quit Apps in Bunch… submenu
Bunch commands (hide dock) (show dock)

Speaking of Bunch…

Related Projects