How to start application in specific workspace programmatically on GNOME 3 [duplicate]

I'd like to write bash script that starts certain application on startup. I would like to have for example Firefox opened in first workspace, Slack on second, spotify on third. I know how to start these applications, but don't know how to place them in specific workspace. Is it possible in Ubuntu 17 with GNOME?


Not exactly a "programmatic" solution, but you may use a GNOME shell extension called Auto Move Windows to achieve your goal (assuming you meant Ubuntu 17.10 with GNOME shell). This extension lets you

Move applications to specific workspaces when they create windows.

Once the extension is installed and activated, open its settings and click on "Add Rule" to select an application and a workspace for the application.

enter image description here