I have installed the "undocumented spaces" module from https://github.com/asmagill/hs._asm.undocumented.spaces. In particular, it provides a method moveWindowToSpace
that I am trying to use to bind cmd+1
to move the the current window to space 1 using the following:
local spaces = require("hs._asm.undocumented.spaces")
function MoveWindowToSpace(sp)
local spaceID = spaces.query()[sp]
spaces.moveWindowToSpace(hs.window.focusedWindow():id(), spaceID)
spaces.changeToSpace(spaceID)
end
hs.hotkey.bind({"cmd"}, "1",function() MoveWindowToSpace(1) end)
This works in the sense that it moves the window to a new space, however, the spaces appear to be in a pseudo random order.
Does any one know how to correctly map spaceID
s, as returned by spaces.query()
, to the actual spaces?