Ubuntu/ Gnome : Open an application in a specific workspace

I have tried the wmctrl tool and found that the easiest solution that worked for me is to move window with the following command:

wmctrl -r <WindowName> -t <WorkspaceNumber>

Note that the workspace numbers starts from 0. Last you can move to your preferred workspace with the command:

wmctrl -s <WorkspaceNumber>

You could use devilspie to set rules for which windows go on which workspace.

See the docs for an example of exactly that.

But MrStatic has a good suggestion too. Try that one first, you might not even need your shell script.

If you need it to be a command you can use in a shell script, have a look at wmctrl.