I think I have a solution for you.
Make sure you've enabled the keyboard shortcuts the way kcwhat has already described.
Then create as many macros like this one as you have different Spaces (you've called them desktops)
You need to change the bits highlighted in red to suit you as follows:
-
Use the same hotkey trigger for each one so you get a conflict palette allowing you to choose desktop 1, desktop 2, etc. In my version, I use control-option-shift-command-P as the trigger.
-
Name each of the macros the same except for the digit: 1, 2, 3, etc so when the conflict palette is show you then just have to press the digit key to make the switch.
-
In each macro, change the keystroke typed appropriately: for example ^1 for desktop 1, ^2 for desktop 2, etc. Obviously these should match the setting you made in System Preferences as described by kcwhat.
That's it. It works here for me provided the window of the app I want to move to a different space is at the front and activated.
Hope this helps.
Extra: I've just been playing with this and noticed some odd behaviour. Like, the first time you use this the app gets moved to the desired space but you're left sitting in the space you've just moved it from. Also, some apps seem not to like having this done to them: for example, iTerm just quits. So, this may not be a total solution, but is probably best considered as a starting point! Good luck!
Addendum: I now know what the problem is: change the value "15" in the mouse click action to "70". The macro was accidentally closing the app by clicking on the red button.