Since Ubuntu has no options to save and restore desktop sessions on shutdown of the computer, I want to write a shell script which helps to setup a customized workspace on a single command. I've found similiar questions on the web. However, I tried gDevilspie and was absolutely lost with that application. Nor do I want to use Compiz as I have made really bad experiences with this software messing up my system several times in the past.

I am looking for a clean an simple shell script which can be called as a command via the Dash. For example, the "office scenario" command would do this:

  • start Atom editor in workspace 1
  • start Terminator in workspace 1
  • start Firefox browser in workspace 3
  • start Slack in workspace 4
  • start Trello (Chromium application shortcut) in workspace 4
  • start Sunrise Calendar (Chromium application shortcut) in workspace 4

Is a shell script the proper way to achieve this goal? If so, what would the shell script need to look like (I have no shell scripting experience so far) and where would it belong to be called as a single command via the Dash?

I appreciate your help very much.

  • 2
  • As this answer askubuntu.com/a/621811/72216 explains, simply chain the commands to open multiple windows/applications on multiple viewports. – Jacob Vlijm Jun 1 '16 at 8:39
  • @JacobVlijm thanks for pointing me to this posting and your comprehensive answer there. I'll try to get your solution to work with my system. However, the question on how to open an app fullscreen-wise is still open in the comments ;). Got a hint? – Bunjip Jun 1 '16 at 19:05
  • Ah, never noticed the comment! should be no problem, using xdotool, and an exclusive argument : fscr or so, BUT, would need an edit of the script. Working on something at the moment. If I finish, I will post an edit tomorrow or the day after :) – Jacob Vlijm Jun 1 '16 at 19:09
  • Cool! So, I will not yet ask how to call a Chrome Application Shortcut via this script (as I have some important apps as Chrome shortcuts only)...? ;) – Bunjip Jun 1 '16 at 19:21

Start several applications with one command

Write a shell script:

#! /bin/bash
atom &
terminator &

Save it as e. g. “myscript”, do chmod a+x myscript and create a shortcut to your start menu (depends on what you're using, just search the web for instructions how to do that).

Open an application in a specific workspace

This is a little bit tricky. Assuming you're using GNOME Shell, try these instructions to bind a .desktop file to a specific workspace. If it works you can define which applications should start where.

Edit: wmctrl is able to send a program to a specific workspace, e. g.

wmctrl -r :ACTIVE: -t 3 # sends the currently active window to workspace 3

You can combine it like

( firefox && wmctrl -r firefox -t 3 ) &
( atom && wmctrl -r atom -t 2 ) &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.