Launch AND quit apps with Bunch 1.0.2

[Tweet]

A quick update to Bunch: it can now quit apps in addition to launching them. If your bunch file has an exclamation point before the name of an app, it will attempt to quit it instead of launching it, making Bunch an actual context switcher. For example, to quit Slack and open Hulu, your Veg.bunch would include:

!Slack
https://hulu.com

Quit lines can be mixed into any bunch, but shouldn’t have files after them (lines starting with a dash). And it won’t work on web urls, so don’t try using it to close your Facebook tab for you. Also, it uses AppleScript, so the app you’re quitting has to respond to the AppleScript “quit” command, but that’s most apps.

I also improved the speed of launching multiple apps a bit (still depends on how long an app takes to launch, obviously), and fixed the build so it will work on systems back to macOS 10.10.

But wait, there’s more! I added the following quickly after I’d already written this post (the download is actually 1.0.3 now). These two features are not fully tested and may or may not work depending on your setup and the apps you try it with…

  1. Adding a line at the end of a bunch that starts with an @ symbol will attempt to focus that app after all of the others are launched/quit, hiding everything except for the target app. The first time you use it it will likely ask you for permission to access System Events. Be sure to approve that if you want the AppleScript to be able to function.
  2. Adding a line anywhere in the file that begins with an asterisk (*) will execute that line as AppleScript. There are some limitations, mostly around Bunch having access to various apps’ Apple Events, but I think I’ve found a workable solution in most cases. This feature also allows you to use do shell script to run command line utilities.

Again, the above two are not well-tested. And again, this is a silly side project while I’m supposed to be working on something else, so please do report issues, but don’t expect much in the way of timely support and/or further updates. (He says knowing that it’s hard to resist the pull sometimes…)

Check out the project page for additional instructions and the updated download!

P.S. Fletcher, if you’re reading this, don’t worry, I woke up too early (4am) and put exactly 1 hour and 12 minutes into this, then got back to work on that one project.