One of the feature requests I get now and then for Bunch is to allow it to arrange windows. Some other batch launchers have this feature, but they usually have a GUI, and making that kind of thing work with plain text files is an ugly proposition. There is a good option, though.
It is possible to Use Bunch and Moom to control windows in multiple desktops/spaces (note that Apple uses both terms to refer to the same thing as different places).
The key point is to have Bunch move to the space/desktop you want the applications, files, and folders to be on, then open them, then have Moom arrange the windows. And then repeat for the next space/desktop. It will take some experimenting with delays in Bunch.
There are two ways to have an application open in a specific space (which you may already know).
When an application is running, navigate to the space you want the application on, right click on the Dock icon, and in the menu select Options > Assign to This Desktop. And now when this application launches it will be placed on the specified desktop.
In Bunch you can specify the space to open on but it requires some set up.
In System Settings > Keyboard > Keyboard navigation - Keyboard Shortcuts (button) > Mission Control > Mission Control (checkbox) â enable the âSwitch to Desktop Nâ keyboard shortcuts for the N spaces/desktops you use.
In Bunch use the syntax {^N}, where N is the space/desktop to switch to. Then list the items to open on that space. Then trigger Moom to rearrange that space. Then move to the next space. Youâll need to experiment with the delays in Bunch to make things work.
Note that if you use method 1, then launching such an application in Bunch will switch to that space, and you can sequence the other apps for that space after this one, again experimenting with delays in Bunch.
I use these techniques in my set up, which has four monitors and ten spaces.
Here is a simple example that works just fine for me.
---
title: Test Bunch
---
# Test Bed for Bunch Ideas
{^7}
PCalc
* tell application "Moom" to arrange windows according to snapshot "Bunch Test" ~2
{^1} ~5
CotEditor ~10
* tell application "Moom" to arrange windows according to snapshot "Bunch Test Two" ~20
* say "good morning Steve"
Note the delays. I had to experiment a bit to get it to work.
The possible issue here is that Moom is being invoked before the applications are launched. Put a delay on this line so that it happens after the last of the applications is launched.
The Moving into numbered space just wasnât consistent with bunch or moom. The apps either opened in the last space or stated in the original space where the bunch was launched from.
Here is a screenshot of my last attempt both apps ended up on top of each other on Desktop1.
---
title: Test Bunch
toggles: false
---
# Test Bed for Bad Bunch Ideas
{^7}
- (pause 5)
Numi.app ~5
* tell application "Moom" to arrange windows according to snapshot "Space7" ~30
{^8} ~2
- (pause 5)
Skype.app ~5
* tell application "Moom" to arrange windows according to snapshot "Space8" ~30
* say "good morning A.B."
The name script was the one thing that always worked.
Are the keyboard shortcuts to move to different spaces working from the Finder? If yes, then the issue is with the bunch file. If not, then that is where the problem lies.
With respect to the Bunch file, it is not clear why the âpauseâ is needed after moving to either space. Nor why you are pausing the open of Numi.
If you are still interesting in troubleshooting, try building the bunch file up one line at a time. Of course you may have already tried this. But it not, comment everything out except the {^7} line, run the bunch, and see if focus switcheds to space 7. If yes, then add the âNumi.appâ line without the 5 second delay, and watch how long it takes Numi to launch (if Numi launches before the switch, then add a delay to Numi). If this works then add back the Moom line, with a delay slightly longer than it takes Numi to launch.
Continuing, the add back the {^8} line with a delay long enough to allow all of the prior steps to complete. That is, donât switch to space 8 until after Moom has arranged the windows. Continue to add back lines adjusting the delays so that each subsequent step happens after all the prior steps have completed.
If you look at my sample Bunch, each delay is larger than the prior delay.
Other things you can check.
Are either Numi or Skype set to open on a specific space? Right click on the icon in the dock and check under the Options submenu. If so, they will shift focus to that space when opening.
Are either Numi or Skype already open when you run the Bunch? (I ask because you have âtoggles: falseâ.)
In System Settings > Desktop & Dock > Mission Control, is the âAutomatically arrange Spaces based on most recent useâ set to on? (This one is just a guess.)
I hope this helps. And let us know how you make out.
One thing to check would be whether you have your Bunches executing in parallel or sequentially. You can force this for any given Bunch by including the followin in frontmatter:
sequence: sequential
That would make sure that everything was launching in order and the delays were actually affecting the next open application. The implementation isnât perfect, but sequential execution would be far preferable for a Bunch like this.
Also curious if youâre intending to use both ~X and - (pause X) at the same time. The ~X delays could just be increased to avoid the - (pause) commands in these cases.
Not that any of that will necessarily solve your issue, Spaces are very difficult to work with in general.
---
title: Test Bunch
---
# Test Bed for Bunch Ideas
{^7}
- (pause 5)
PCalc ~5
* tell application "Moom" to arrange windows according to snapshot "Bunch Test" ~30
{^8} ~2
- (pause 5)
CotEditor ~5
* tell application "Moom" to arrange windows according to snapshot "Bunch Test Two" ~30
* say "good morning Steve"
And obtained the following results.
The {^7} and {^8} were seemingly ignored as focus did not change.
The âgood morningâ command was executed.
PCalc and CotEditor both opened on the same space (the space the bunch was run from).
Both Moom commands were executed.
Removing both pause commands gave the following results:
Focus was shifted to space 7.
The âgood morningâ command was executed.
Focus was shifted to space 8.
Both PCalc and CotEditor were opened on space 8.
Both Moom commands were executed.
As far as I can tell this is what is happening, in the âno pauses versionâ.
Focus shifts to space 7 as it is first and has no delay.
The âgood morningâ command executes next as it has no delay.
After a 2 second delay focus shifts to space 8.
After a 5 second delay both PCalc and CotEditor launch.
After a 30 second delay both Moom commands are executed.
Also note that Moom cannot reach across spaces. So it only âseesâ windows in the space that has focus. Thus having both Moom commands on a 30 second delay means that they will both execute on whichever space as focus after the 30 second delay. To make it work as you want, youâll need to ensure that the appropriate Moom command executes while the desired space still has focus.
I added sequence: sequential but it seemed âto meâ that it did the last line first. Both apps ended up on space 7.
---
title: Test Bunch
toggles: false
sequence: sequential
---
# Test Bed for Bunch Ideas
{^7}
Numi.app ~5
* tell application "Moom" to arrange windows according to snapshot "Space7" ~15
{^8} ~20
Skype.app ~5
* tell application "Moom" to arrange windows according to snapshot "Space8" ~35
* say "good morning A.B."
---
title: Test Bunch
toggles: false
sequence: sequential
---
# Test Bed for Bunch Ideas
{^7}
Numi.app ~5
* tell application "Moom" to arrange windows according to snapshot "Space7" ~20
{^8} ~45
Skype.app ~50
* tell application "Moom" to arrange windows according to snapshot "Space8" ~60
* say "good morning A.B." ~75