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
Create two shortcuts for each focus mode you want to control from Bunch, one for turning on, and one for turning off.
Then, in a Bunch, you can use
$ /usr/bin/shortcuts run "SHORTCUT_ON_NAME"(replacing
SHORTCUT_ON_NAMEwith 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"
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:
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.