Automate moving an Application to a Space


I have created some macros in Keyboard Maestro to open up a mix of Applications and files which I use in a certain situation. It’s been working great.

However, I’d really like to split this stuff across at least two Spaces. As it is now, I have it so that everything gets opened on whatever Desktop/Space I’m on when triggering the macro.

I haven’t been able to find a good way to do this properly. Any ideas?

1 Like

do you want to have a default space per app?
because that can be set per app once it is open.

or do you want to do it per activity?

No, I want to specify the Space the App is opened in by the particular macro - either by being opened there directly or by being moved there.

So, the macro today opens a handful opp PDFs as Tabs in PDF Expert, a project in Scrivner, a couple of tabs in Chrome and some in Safari.

They all open on the Spaces/Desktop I’m on when I trigger the macro (which I’ve sorted out by having the macro close the Apps in question first before starting to open the various items).

I’m adding some things in here and would like to distribute it across two Desktops/Spaces.

I do not want to change the default Space of the Apps since this is only relevant in this particular case.

Perhaps SizeUp could help? It allows you to move windows sequentially between spaces (so 2 spaces is the ideal) and it is AppleScript enabled.

Otherwise I believe the only way currently is to leverage key presses for preset spaces actions (ref.).

Hope that helps.

MooM or Stay would also do window placement, but am not sure whether they could do it across spaces.

I agree with @sylumer that SizeUp would probably be a good fit. As it is keyboard shortcut based KM can integrate fairly easily. (did not look at the applescript options)

Alfred can also be an option, there are several scriptable plugins that can do this.

Both apps explicitly say in their documentation that they do not deal with spaces, only Windows placement.

I believe these are all based on the same triggering assigned key presses approach mentioned above.

I do this by setting up keyboard shortcuts for each space (in my case ctrl -1 through ctrl-9). I then use keyboard maestro to “press” the keyboard shortcut for a given space, then open the app I want in that space, and then repeat as many times as desired. It’s a work-around that works for me. Hope that helps.

Also: For this to work, the apps must not be open before triggering the macro and judicious use of Keyboard Maestro “Pauses” of maybe a second or so to allow each step to complete are needed.

1 Like

You can also use an AppleScript in Keyboard Maestro to switch to the right Space first and then launch the programs.


tell application “System Events” to key code 19 using {control down}

Space 1 is key code 18,
space 2 is key code 19,

For some reason only space 1 to 4 can be changed to this way.

1 Like

Thanks for all the suggestions!

I was hoping there was some script way to accomplish this without keystroke simulations, but that seems not to be the case then.

So I’ll play around with the suggestions above and it should do the job!

Doesn’t the SizeUp suggestion using AppleScript provide an option that isn’t based on keyboard shortcuts?

Ahh, yes. But I have too many new Apps to wrap my head around already. :sweat_smile: