Script For Moving Apps To **Different** Spaces

Does anyone have a script available to move various apps to different spaces? I’m down to one monitor for now and I’m forced to use spaces even though I believe the functionality has been largely forgotten by Apple.

I’ve tried writing both AppleScript and a Hammerspoon script to move apps to other spaces with no success.

The Goal: move apps to other spaces without needing to launch Mission Control and use the mouse. If there is a script, I can’t use Hammerspoon or Keyboard Maestro as the trigger.

It should be possible via yabai, I think.

I made an Alfred workflow that uses yabai to move a window from another space to the current space. The used yabai query is…

/opt/local/bin/yabai -m query --windows

…and the output also contains each windows’ app. So it should be possible to collect all windows for a given app and then move each window to the desired space.


It should also be possible to create a yabai rule that automatically moves all windows of a given app to to the desired space.

No Yabai, I’ve tried it and don’t like it. It has to be Hammerspoon or Keyboard Maestro.

In what fashion? Spaces appear to be a mature feature that works as intended.

It is not clear what you mean by “move apps”? Do you mean move windows? If so, Better Touch Tool provides a mechanism to do this.

But as it is not clear if you are saying that you:

… or …

In which case if it is the latter then Better Touch Tool would not be an option.

I only mean that you can’t move application windows to different spaces using the keyboard or AppleScript without a 3rd-party application.

Yes, I mean application windows. For example, move a Skype window from space 2 to space 7. And you are right BTT does solve this problem.

I was saying that I couldn’t easily get Hammerspoon, Keyboard Maestro, Moom or AppleScript to accomplish this.

Now my problem is:

I have three different apps just to manage windows with the keyboard which is very frustrating.

  1. Hammerspoon - To do main window movements
  2. Moom - To save a window layout and launch them in same position every time with the help of Bunch.
  3. BTT - To move application windows between spaces with the Keyboard.

I need help with

  1. I need help eliminating 2 of the 3 applications.

Is there a reason other than you just want a simpler set up? What is it that is causing the frustration?

If this set of apps is giving the desired results then why not just let them run in the background? I do not use Hammerspoon, but (as you may recall) I do use Moom (with and without Bunch) and Better Touch Tool, and when I directly interact with these apps it is either:

  • at setup, done rarely and is generally a one time thing;
  • via the keyboard, so that the interface is the same for interacting with both (and I assume this would be true for Hammerspoon).

And given that I call Bunch from the keyboard, all three apps present as just a set of keyboard shortcuts. Thus I do not think in terms of which app to use, but rather which key combination.

But if you really wish to use but one of Hammerspoon, Moom, and Better Touch Tool, then I suggest you look into BTT’s window management features.

Good luck and have fun!