Posted by: rusteddev | March 5, 2011

Instant start your multi-workspace Dev Environment on Ubuntu

To be productive, my My RoR development environmment requires many windows to be opened simutanously. I also use the 4 Ubuntu workspaces.

This is how my everyday RoR working environement is set :

Workspace 1 : Eclipse RadRails. I don’t use terminals sub-windows  as it reduces the size of main window (the one displaying code).

Workspace 2 : Gnome terminals with Rails Console, Rails Server (WebRick),  Autotest, Spork (to improve tests performance), Cucumber (to execute User Acceptance tests), Git Gui (to commit, push and pull my changes)

Workspace 3 : 2 Firefox windows : 1 for web search and 1 for testing the web app

Workspace 4 : for my pro and personal mailbox, instant messaging.

I wanted to quickly open this environment at computer start-up so looked for a way to automate windows opening at startup. Two things were more tricky : set a title to a terminal window and move windows to one particular workspace. This is how I did.

To start a terminal and set a title :

  1. First you need to set up your profile so that title can be set using command line. To do this open a terminal (Ctrl-Alt-T), go to Edit, Profile preferences, “Title and command” tab and in the “When terminal commands set their own titles” choose “Keep initial title
  2. You may then use the following command line in a shell script to open a terminal with “rails_s” title and executing the rails s command. The maximize option is here to set the terminal full screen.
gnome-terminal -t rails_s -x sh -c "rails s" --maximize &

To move the opened terminal to a particular workspace :

I did not find a way to do this using gnome-terminal options. The only solution I found googling is to use devil’s pie. It’s an  utility designed to change the behavior of opened windows.

  1. Install devil’s pie by running the following command
  2. sudo apt-get install devilspie
  3. Create template file called terminal.ds for your terminal window and copy paste the following code :
  4. (if(is (application_name) "Terminal")(begin(set_viewport 2)(maximize)))

    note that this template applies to all windows named “Terminal” moving it to workspace 2 and maximizing it. set_viewport is the command to use instead of set_workspace when you use compiz.

  5. Start Devil’s pie to move windows to particular workspace. This should be done by script
  6. devilspie terminal.ds -d &
    gnome-terminal -t rails_c -x sh -c "rails c" &
    killall devilspie

    killall is important if you don’t want every new terminal window to be automatically moved once the script is finished. On the contruary, note that you might need to sleep a few seconds after executing slow-to-start application like Eclipse so that devil’ss pie is still running when the window is opened. This might require tunning.

Et voilà ! Adapt this script to your needs, run the script after startup and your environment is started.



  1. ok, now you blogged this : can you commit it, team-mate, please :)))

    -another Ubuntu user

  2. I want the same on Leopard bro

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: