Hammerspoon / hammerspoon

Staggeringly powerful macOS desktop automation with Lua
http://www.hammerspoon.org
MIT License
11.86k stars 578 forks source link

Moving Apps To Spaces #3613

Open bocciaman opened 6 months ago

bocciaman commented 6 months ago

Is there a Hammerspoon script to move apps to different spaces (^NUM)? I've tried the MoveSpaces spoon, but the documentation is blank. I have the spoon installed but no way to control or manage it.

ulises-castro commented 4 months ago

My approach is list all spaces, store spaces ids into an array, then look for app's windows (by using window.filter) and move every window to the desire space. I did not able to find another way, the documentation is not good.

dmgerman commented 4 months ago

Here a spoon i have been writing for managing spaces. The fundamental problem is that space management in OSX is a joke/mess. for example, full screen applications get their own space.

https://github.com/dmgerman/hs_dmg/blob/main/Spoons/BetterSpaces.spoon/init.lua

there are functions to move to the ith-space in a monitor (skipping fullscreen applications).

if interested, I can fork it into its own repo, so others can contribute.