Welcome to the lab.

Bunch: Focus Modes and other tips

I put some time into Bunch this weekend. It’s been a little while since I’ve worked on it — I haven’t needed it to do anything new lately, and the current release hasn’t had any major bug reports. So it’s been happily humming along. But there was one feature request that I did keep receiving and decided to take another look at.

The request is for support for Monterey’s focus modes. Bunch does a decent job of enabling and disabling Do Not Disturb, but the process is a hack that involves nested settings in PLIST data and toggling system daemons. I don’t love that I have to do that, but Apple provides no API for such settings. And I haven’t found a way (yet) to extend that hack to work with Focus Modes. So I offer a workaround: you can turn Focus Modes on and off using Shortcuts, and you can easily run Shortcuts in a Bunch using the shortcuts CLI.

  1. Create two shortcuts for each focus mode you want to control from Bunch, one for turning on, and one for turning off.

  2. Then, in a Bunch, you can use $ /usr/bin/shortcuts run "SHORTCUT_ON_NAME" (replacing SHORTCUT_ON_NAME with the name of the shortcut that turns the focus mode on), and !$ /usr/bin/shortcuts run "SHORTCUT_OFF_NAME". The combination of these two will turn the focus mode on when the Bunch opens, and off when it closes. You can, of course, reverse these as needed.

    $ /usr/bin/shortcuts run "Work Mode"
    !$ /usr/bin/shortcuts run "Work Mode Off"
  3. There is no step 3.

Now when you open and close the Bunch, your desired Focus Mode will toggle on and off with it. It’s a couple extra steps beyond having a Bunch command to handle it, but I don’t foresee being able to incorporate them directly. Of course, I may just be missing something in the API that would make it possible without deep hacks, in which case I will definitely incorporate it.

Single Bunch Mode Grouping

Another request I got led to a couple of bug fixes. The following currently only works in the 2.4.8 beta (download here), but if testing goes well, it will be released to the stable version in short order.

What came up was the idea of having Single Bunch Mode apply to subsets of Bunches.

Single Bunch Mode can be enabled in preferences and simply means that when a Bunch opens, all other Bunches close, so you’re only running one at a time. Because Bunch is built for “context switching,” this makes switching your working context a single step. You can have any Bunch ignore Single Bunch Mode using frontmatter, so Bunches that should always be running can be easily excluded.

However, you might want to have multiple groups of Bunches where only one Bunch within the group is running at any given time. This can be accomplished with Bunch’s tagging features.

To tag a bunch, you just add frontmatter:

tags: work

Tag all of the Bunches in this subgroup with the same tag. Then, in each Bunch in the group, use the \tag syntax to act on the tag. Use ! to indicate you want to close the tagged Bunches, and include a % sign to ignore the directive when closing (so it doesn’t reverse it and reopen all of the tagged Bunches).


This effectively gives you Single Bunch Mode for subsets of Bunches. If you ever want to do that, give it a shot.

Web Excursions for March 15, 2022

Web excursions brought to you in partnership with CleanMyMac X, all the tools to speed up your Mac, in one app.

I’ve started a collection of scripts for Hook. It’s small right now, but should grow in the future. Worth a bookmark or a star if you’re a Hook user.
1Password for SSH & Git (Beta)

Introducing 1Password for SSH & Git (Beta), the single source of truth for all your SSH keys.

Zettel Composer: a tool for combining notes — Zettelkasten Forum

After about a year of personal experiments, I present you the “Zettel Composer”, a script for combining Zettelkasten notes in a variety of situations: browsing annotations, publishing a book or a paper, assembling a handout for lectures or conferences etc.

Kaleidoscope Developer Tools for Safari
The good folks behind Kaleidoscope have added a Safari extension. It adds a ksdiff() function to the debugger that you can call from the console or breakpoint actions. It can also diff the source and CSS of any page or element, which is amazing for web development and debugging. Nice work!
cedstrom/powermate-osx: Griffin Powermate Driver for macOS
A little driver for the Bluetooth Griffin Powermate, perfect for advanced scripting and integration with a tool like Hammerspoon.

CleanMyMac X

He’s Doing it again…

I’ve added some stuff to Doing lately. Like, a lot of stuff. To be fair, I’ve also done a lot of jobby job stuff. And worked with Fletcher on nvUltra. And started a rewrite of Gather as a menu bar clipboard web Markdownifier with integration with multiple apps (that one’s going to be cool if I finish it). And some time on Bunch. But as I’ve said before, the one thing I use when working on all of these is Doing. And I always want it to do something new or better, so it gets some attention.

Oh, and looking at my doing recent output reminds me that I also tried my hand at creating my first oh-my-fish plugin yesterday. It has some dependencies and I don’t think it’s right for the main packages repo, so you have to add the repository manually to try it out, but I think it’s fully functional. If you want intelligent directory navigation with bookmarks, fuzzy matching, and fasd/fzf integration in Fish, all in your cd command, check it out.

Anyway, what were we talking about? Hang on:

doing last...

Right. Doing updates. To get the latest version, just run gem install doing, which as of this writing should get you at least version 2.1.34. (If you get an error, run the same command with sudo.)

Keybindings cheat sheet for Dash

It’s been a while since I mentioned my macOS key bindings, so if you’re new around here, let me point you to my previous work.

I’m pretty crazy about text input shortcuts and have spent a fair amount of time honing a system that lets me use selection, editing, Markdown, HTML, and other shortcuts everywhere you can type on macOS. I’m so used to them I make a mess typing on other people’s computers. I try to avoid doing that. Typing on other people’s computers, I mean.

I share a large collection of all of my favorite key bindings on GitHub. Everything is contained in the file DefaultKeyBinding.dict, which is what macOS reads all key bindings from. In that file I use formatted comments to describe each binding, and I can generate the README and blog page by parsing the bindings file itself. The script that generates the table of shortcuts creates it in Markdown and then uses MultiMarkdown to output the document, ready for GitHub or my project page.

I also generate a cheat sheet for Cheaters from it, but I’ve been using Dash more than Cheaters for the last couple of years. So I wanted my key bindings in a Dash docset for quick reference.

Yes, there is such a thing as too many shortcuts. I walk that line. But I manage to not have so many that I’m accidentally triggering them while doing something else, so I think it’s just the right amount. It’s just more than (even) I can remember all at once. Which is why a searchable cheat sheet you can pop up with a keystroke is handy.

So I modified the documentation generator to output a template for the cheatset gem. It will read whatever is in your KeyBindings.dict file and generate a Keybindings.docset file for you based on the definitions and comments in the file. So you can take my oversized DefaultKeyBinding.dict file, trim it down to what you want to use (leaving comments in place), and generate a custom cheat sheet for your own key bindings.

Download the code to get the script (and the bindings file). Make it executable with chmod a+x cheatset_keybindings.rb. Before running it, you’ll need to install the cheatset gem: gem install cheatset should do it, though you might need sudo gem install cheatset, depending on your setup.

You can point the script to whatever DefaultKeyBinding.dict you like by passing a path as an argument. It will default to using the one in ~/Library/KeyBindings.

The script can output the key combinations either as symbols, e.g. ⌃⌘p or as names, e.g. CTRL+CMD+P. “Name” is the default format; to output symbols instead, use --format symbol.

You can also change things like the docset title and description using command line flags. Just run cheatset_keybindings.rb -h to see the options.

By default the script will generate the template, then run cheatset to generate the docset, and then delete the template, leaving just the docset. If you just want the template, run the script with --save. Then you can edit the template and run cheatset generate TEMPLATE yourself.

I made this because I needed it, not because I expected it to be a popular project. If it’s of use to you, though, please enjoy!

Brett’s Favorites 2021

I’m late getting my “Top Apps of 2021” post out. I almost wasn’t going to do it this year, mostly out of just being frequently and excessively tired of late. But I figured I’d keep it short and make it manageable, and at least let you know what I think are the cream of the crop Mac apps this year. This is nowhere close to a comprehensive list of apps I like, but rather apps I love that were new or substantially updated in 2021.

I’m forgoing1 iOS apps because I just haven’t found anything new that blew me away this year2.

Many of the apps below are available on Setapp. If you want to check it out and get access to 100+ awesome Mac apps (and some iOS companions) for a low monthly subscription, here’s my affiliate link. I get a little something if you sign up, and if you happen to use my apps through Setapp, I also get a piece of your monthly payment, which I think is nicer than switching an app like Marked 2 to a subscription model on its own.

And we’re off.

CleanShot X
This is the best screenshot app I’ve ever used. Everything about it is elegant, intuitive, and powerful. Available on Setapp.
I can’t use Fantastical with my work calendar (employer limitations), but Dato at least puts my calendar in my menu bar with some handy features, including “Join Zoom Call” buttons that actually work. Solid app and one I use daily.
BTT always makes my list, and is always improving. I couldn’t begin to enumerate all the new features Andreas has added in the last year. If you’re looking for one of the best Mac automation/enhancement tools out there, this is it. Available on Setapp.
Back from the dead, Kaleidoscope is under new management and active development and remains my favorite tool for file and directory diffs, as well as resolving merge conflicts.
A bunch of improvements last year in this top-notch Git GUI. And I highly recommend the tutorials that they put out on their website — they’re a great way to learn more about areas of git you might not be well-versed in.
I love iTerm so hard. I’ve tried other terminals, but iTerm packs so many awesome features in that nothing else can really come close.
Hook had a big year in 2021. As I’ve said before, it’s a bit hard to explain in a couple of sentences, but if you want to always have relevant files and documents at your fingertips while you’re working without spending time searching, it’s worth learning how Hook can help.
If you edit podcasts (or even video), you have to try Descript. It generates transcriptions automatically, and then you can edit the audio/video just by cutting and pasting the text. They’ve added a host of effects and audio tools this year, and just released an M1-optimized version.
I pay to upgrade ScreenFlow regularly, and it’s pretty much always worth it. If you need to create screencasts, whether long presentations or 5 second gifs, ScreenFlow is hands down the best tool for the job.
It’s just one of my favorites. It keeps your menu bar clean. The new features in version 4 are outstanding.
It’s not new, but I just started using this one in 2021. It regularly scans all of your installed apps, Mac App Store and direct versions, and lets you know when updates are available. It makes installing them easy, and can do batch updates at the click of a button. Regularly updated and improved.
Brand new in 2021, this is an awesome tool from Tyler Hall for performing a wide array of operations on text. It comes with System Services (or Quick Actions or whatever macOS is calling them now) you can set up for easy keyboard control, and is fully extensible with JavaScript. If you dig a little, you can even learn how to include your own System Services in the array of available operations.
This one didn’t have any major updates in 2021, but it’s still solid and I use it often enough that I thought it worth mentioning. It’s the easiest way to edit launchd jobs for running background tasks on your Mac. I don’t know what ever happened to Lingon, but this is better anyway.

That’s it (for now). Short and sweet. I might do a second installment if time allows, but for now have a great 2022!

  1. Today I learned that there’s a difference between “foregoing” and “forgoing” (other than an “e”). Glad I caught that one. Would have looked mighty silly. 

  2. To be fair, I do not do a lot on iOS other than social media, email, text messaging, and games. Which I guess is a lot, but other than games, none of those areas are rife with competitors and new ideas.