I would like to be able to tell at any time which mission control workspace the user is currently using programmatically on macOS 10.13. I could not find any working answer during my search. Any langage will do, and any workspace identifier works for me (uuid, workspace number...)
Thank you for the help!
Looks like this requires undocumented API calls.
https://github.com/asmagill/hs._asm.undocumented.spaces/blob/master/CGSSpace.h
and
CG_EXTERN CGSSpaceID CGSGetActiveSpace(CGSConnectionID cid);may do what you want, but this code hasn't been touched in 3 years so system/api may have migrated, and all the problems with using undocumented APIs apply.
Found this in the project https://github.com/asmagill/hs._asm.undocumented.spaces
haven't used or verified it.