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.
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.
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.