Better Bunch for LaunchBar

This post is specifically for people who use Bunch with LaunchBar. If you happen to be an Alfred user, Jay Miller is cool guy who also develops an Alfred action for Bunch. Thanks Jay!

I made such a huge improvement to the “Bunches” LaunchBar action that I had to bump it straight up to version 2.0. Bunch has been improving, so this little one has to keep up. It’s the way of the world.

The action previously just read your Bunches folder and launched them with the URL handler. The URL handler has expanded, though, and there was a bunch1 of stuff I wanted to be able to do from LaunchBar. I actually use Bunch as much from my launcher as my Dock now, so it was worthwhile to put some time into it. Here’s what’s new:

  • Caching preferences retrieved from defaults read to speed things up

    Using defaults to determine the Bunches folder and the Toggle Bunches preference every time the action was selected was adding 2-4 seconds of delay. I changed it to read the preference plist directly, which cut down the domain search time, but it was still consistently slow. Those preferences aren’t likely to change all that often, so now it just caches them in the actions’ own preferences and only has a short delay once every few days when it refreshes.

    The cache is set to last for 3 days at a time, and you can force a refresh from the settings submenu.

  • Allow setting a default action (Toggle, Open) that overrides your Bunch preferences

    When Toggle Bunches is enabled in Bunch, the Dock shows checkmarks next to open Bunches and it makes sense to have the preference there. From LaunchBar, though, I don’t have access to the list of what’s currently launched, so it makes more sense to set the Action to default to “Open”. If you open the settings menu (the last item when you arrow into the Bunches action), you’ll see the item that overrides that preference.

    Bonus: once you’ve set that, you’ll never suffer from that particular defaults read delay again.

  • Every Bunch listed now has a child menu that offers whichever actions aren’t default If the default action is Open or Close, hitting the right arrow (or Ctrl-L) will offer you the opposite option. If it’s on Toggle, the options will include both Open and Close.
  • Holding modifier keys when opening the action changes the default methods for that run
    • Ctrl: close bunches
    • Command: toggle bunches
    • Shift: open bunches

    After you type bunch to select the Bunches action, hold down the Ctrl key as you arrow into it. Everything will default to Close. It’s handy once you memorize the keys. Or maybe I’m just too keyboard-nerdy.

  • Bunches can now accept strings

    If you press Spacebar when the action is selected, Bunches will accept a string and execute it using the raw?txt= method of the URL handler.

    You could just run (dnd off) to toggle Do Not Disturb. You can pass a longer string with more commands, but note that you need newlines between each command, so typing them in LaunchBar is not feasible. But…

  • Bunches can now accept files, too

    You can select a Bunch file (with or without .bunch extension) from anywhere on your system and hit tab to execute it in Bunch. Using this method will always run them with the raw?file= method, which means they’re always going to open, even if you hand it a Bunch that’s in your main Bunch folder and already running. It treats all received files as “outsiders,” which is what the method was intended for.

  • I made some new icons. I’ll hate them by tomorrow, I always do

If you’re wondering about the CLI, the only thing I’d really like to fix there is the same defaults read delay. I updated the gist with the read-directly-from-plist modification, but it could still stand some caching. I’d also like it to accept text from STDIN for raw?txt= handling, and files as arguments for raw?file= handling. I rewrote the LaunchBar action in JavaScript, so it’s completely diverged from the Ruby script and will be a separate project.

In the meantime, the LaunchBar action is packed, codesigned, and ready to go. Download below!

Bunches LaunchBar Action v2.0.1

A LaunchBar action for Bunch

Published 05/22/19.

Updated 06/08/19. Changelog

DonateMore info…

  1. Sorry.

Brett Terpstra

Brett is a writer and developer living in Minnesota, USA. You can follow him as ttscoff on Twitter, GitHub, and Mastodon. Keep up with this blog by subscribing in your favorite news reader.

This content is supported by readers like you.