Welcome to the lab.
I should probably eventually try to make money off of Bunch. But for now it’s just what I’m going to do to stretch my fingers (and brain) in the morning before I start my day’s work on nvUltra (I’ll post an update on that soon, things are going quite well).
First things first, I finally added automatic updates (Sparkle) to Bunch. Now it will ask you if you want to check for updates and will just let you install new versions with the click of a button. Adding this meant admitting to myself that I was going to keep updating it, but it’s hard to deny that at this point.
This also means I’ll stop overloading my blog with notes on every update. The project page will continue to be updated with the changelog, and I’ll only post about “big” changes.
I added a new syntax for running commands that are built in to Bunch. You just put the line in parenthesis and if the enclosed string matches a valid command, Bunch will execute it. Commands are mostly going to be shortcuts to system events. Right now, the only commands are “hide dock” and “show dock.” I’ll add more as I need to.
Next new feature is the ability to quit Bunches. There’s an option in the Preferences submenu (also under Bunch in the menu bar) called “Toggle Bunches” that will set a preference for you. When enabled, when you launch a bunch, its menu item gets a checkmark showing that it’s active. Clicking a checked Bunch will reverse it, quitting any apps it launched, ignoring lines for files, focus, quit, and AppleScript.
There’s also a submenu called “Quit Apps in Bunch…” that contains a list of all of your Bunches so you can quit the apps for any Bunch, even if you haven’t activated the Bunch previously.
Finally, there’s a mode called “Single Bunch Mode.” You can toggle it in the menu bar under Bunch->Single Bunch Mode. When this is active, launching a Bunch will quit apps in the last Bunch prior to launching the new Bunch. If the new Bunch contains apps existing in the previous Bunch, those apps will be ignored.
If two Bunches have overlapping apps, nothing happens to those apps when switching Bunches (so the app doesn’t quit and relaunch). Same with Dock Commands, they won’t be doubled up.
A tip for using Toggle/Single Bunch Mode: Don’t include apps in your Bunch that you generally always have running anyway. That way when you quit apps in a Bunch, you won’t have to relaunch them.
In the same vein, I thought it would be nice to hide all open apps when launching a bunch. You can now include a line with just “@@” on it, probably at the top of your bunch file, and it will just breeze through all open apps and ask them to hide. The only ones it misses are menu bar apps like Dash or nvALT. Not much I can do about those if they’re not running in the Dock.
I had previously included a feature where putting an underscore after an app name, e.g.
Slack_, would hide it after launch. It’s not perfect. Slack is actually a great example of its imperfection… Bunch waits a few seconds and hides it, but Slack takes long enough to launch that it becomes active again when it’s finished loading. I’ll see if I can find an efficient way to handle that, but I note that even Login Items with “Hide” checked often fail to do so.
As always, have fun, and enjoy the ease of automatic updates (assuming they work as well in the wild as they did in testing…). Download and updated docs on the Bunch page.
Yeah, this has become my morning habit. Make coffee, add something to Bunch. If you haven’t been following, Bunch is my batch application launcher for the Dock that I wrote way back on Tuesday of this week. As of today, it’s not just for your Dock anymore.
Bunch now has a url scheme. This means that a link like
x-bunch://open?bunch=My%20Bunch will run your “My Bunch.bunch” instantly. You can run them from scripts with
open "x-bunch://open?bunch=...", embed them in links, or use them in apps that allow url handlers as extensions. You can also use them in BetterTouchTool or Keyboard Maestro to put bunches on a hotkey. Note that Bunch can’t currently run Bunches if you call the URL while it’s not running. It will launch, but you’ll need to have it running to actually trigger a bunch via the url handler.
x-bunch handler is case insensitive (“my bunch” works as well as “My Bunch”). It also has a shorthand version because there’s only one method on it (open):
x-bunch://My%20Bunch. Just the scheme and the name of the bunch is all you actually need.
Oh, and by the way, you can change the location of your Bunches folder to anywhere you like now. Just choose “Change Bunches Folder” from the Dock menu and select a new folder. Maybe one on Dropbox so you can sync your bunches…
I think these add a little extra utility to my little utility. Download (and documentation) on the project page. Enjoy.
By the way, if you like this stuff, consider becoming a member or making a one-time donation with the button below. My morning coffee isn’t free…
Apparently this is just what I do early in the mornings now. Bunch 1.0.4 is out. It’s a pretty heavy code overhaul, switching most functions that were using AppleScript over to NSWorkspace, which you probably won’t notice but it solves some security and performance issues. It also does a better job of checking whether it really needs to execute a function (i.e. is the app already running? Closed? Hidden?). It’s speedier all around.
The real front-facing change is that it now handles any URL scheme. Previously it only opened web urls, but now you can put any url handler call on its own line and it will be executed just like any URL.
There’s also a feature where you can put an underscore at the end of an app name and it will hide the app after launch, but it’s not consistently working yet. (I don’t want to just sit and poll for the app to finish launching, and I couldn’t get a notification observer to function properly with appDidFinishLaunching…). So that’s kind of a hit and miss feature that’s not included in the docs yet.
That’s all, I have to do real work now. This little app has come along nicely, though. Download and updated docs on the Bunch project page. And yes, I really should just go ahead and add Sparkle to it, but I’m just not taking it that seriously yet.
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:
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…
- 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.
- 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.
Thanks to Taz Goldstein on Twitter, it came to my attention that my tool for generating downloads for my TextExpander snippets had partially broken. In the process of fixing it, I made some improvements.
If you haven’t seen it, the tool is called TE-snippets. It takes all of the TextExpander snippet groups that I have available in my TextExpander Tools project and makes it possible to customize the triggers and create a subscription link or direct download with the results.
The biggest update I snuck in while fixing it is the ability to use suffixes instead of (or along with, if you really wanted to) prefixes. Just set one or both in TE-snippets and it will be included in any customizable snippet triggers. Leave either or both blank to skip them. Note that some triggers aren’t set up to be customizable, but most are.
Why suffixes and prefixes? For a long, long time I started all of my snippets with a punctuation prefix, usually
,,, to separate the triggers from strings I might actually type. I’ve been using suffixes more and more; It’s a personal preference, but I always use one or the other. If I’m triggering the snippets after a delimiter (space, tab, etc.), I like to use a hyphen at the end. So
ot- expands to
Overtired after a space (but if I happen to be actually hyphenating a word, it doesn’t because the next keystroke is a character). I can keep the snippets short and still avoid accidental triggers, and using a consistent prefix or suffix makes it significantly easier to train the muscle memory that makes TextExpander ten times more useful.
So, if you haven’t checked out TE-Tools for a while, do it! Even if you’re not a TextExpander user, maybe my TextExpander Tools will inspire you to check it out. As far as I know, the snippet groups I generate will work on any of TextExpander’s supported platforms (including Windows, which I imagine is a bonus for dual-platform users).
While TextExpander frequently sponsors this blog and supports my work, this project isn’t paid for by Smile or TextExpander. This is just me being a huge fan.
I made you a thing this morning. It’s called Bunch and it’s a utility for launching preconfigured groups of apps and documents.
Bunch sits in your Dock with no windows. When you right click it, you get a list of your “bunches,” and selecting one launches, well, a bunch of apps. It’s designed for starting a new “context” on your machine, e.g. a specific project, or just “work” or “play.”
Bunch can launch apps, open specific documents in an app, and load web urls. It’s pretty simple. I mean, I wrote it this morning in about an hour.
As a teaser/example, here’s what happens when I choose “nvUltra” from Bunch:
- Launch MeisterTask
- Launch Slack
- Launch Xcode and open nvultra.xcodeproj
- Launch Tower and open the nvUltra repo
- Launch iTerm (if it isn’t already)
- Launch Sublime Text and open the documentation project and the “themes” project
See? It’s useful. Check it out on the Bunch project page.
I’ve more or less finished a little side project I started to make it easier to find and use Marked Custom Styles. I have a lot of plans for improving the styling system itself, but for now I wanted to make a little more user-friendly way to look around than just going to visit a GitHub repository.
First, some background. Marked 2 is my Markdown previewer app. It comes with 9 built-in preview styles, but allows total customization using CSS. You can learn more about using custom styles in the help docs. You’ll also find instructions and tips for creating your own.
When users are willing to share their work, I collect them in a public GitHub repository. The problem is, that doesn’t provide any previews, so you end up downloading the whole lot and testing them out in Marked, which is far from convenient. The opposite, in fact.
So I created a little gallery system that indexes all of the styles in the repository, catalogs their metadata, and creates a single-page gallery. You can select styles from a dropdown, or page through them one at a time. If you find one you like, there’s a download button that will take you directly to the source code. Check it out.
As I work on nvUltra I’m designing some new styles for its built-in preview. I ported the current state of one of my favorites, Gregarious, to Marked. You can check it out in the gallery.
As a side note, you can set a hash on the gallery url to target a specific style (e.g.
[url]#Gregarious), perfect for linking directly to that style. As you browse the hash updates, so copying the url at any point will link directly to the style you’re currently viewing.
I’m hoping that offering a little more convenience in this will inspire more people to share their own Custom Styles with the world. To do so, be sure you’ve included the required header comment (detailed here) and then either contact me directly with a link to it, or create a pull request on the GitHub repo (if that’s your thing). Someday I’ll make an actual community system with uploads and all, but that keeps getting pushed off. So much to do these days.
If this note applies to you, you already know what a Hyper key is. If you don’t, go ahead and start with the post I wrote a while back on using Karabiner Elements to make your Caps Lock key more useful. If you’re starting from scratch, you won’t need the info below, I’ve already updated the instructions.
Fixing the Hyper key
For those of you using my original instructions, you may have found that some or all of your Hyper key functionality disappeared with a recent update of Karabiner Elements. (I think it has to do with much stricter JSON parsing that was implemented, but the solution doesn’t necessarily validate that.)
To get your Hyper key back, the first thing to do is remove the current Hyper key rules in Karabiner Elements preferences. Select the Complex Modifications tab and find the “Change caps_lock to…” rule, then click the Remove button on the right. Then add it back in using the “Add Rule” button at the bottom. You can also just go straight to my example and edit in the definition yourself (
~/.config/karabiner/karabiner.json), if you prefer.
Escape key functionality
The default Hyper key rule that’s imported won’t have the added benefit of making your Caps Lock an Escape key when pressed alone. If you want that part, you’ll need to edit
~/.config/karabiner/karabiner.json to add the to_if_alone key to it, as seen in line 33 of the example. The original config I offered had an extra
modifers key in it, which is what was breaking the Escape key functionality. Removing those lines as shown in the example will restore it.
This solution is thanks to tweets from Joakim Kemeny and Chris Salter. I’m grateful and very happy to have my favorite modifier key back.