For many developers (such as myself), the first thing we tend to do when we login to our desktops, is to launch gnome-terminal (or similar) with a number of tabs and then will typically have to setup a bunch of environment variables in each tab.
Most of us have probably simplified this at least somewhat by creating a file that sets our environment variables for us when we do
. ~/project.envor something to that effect.
The problem is that if we have multiple tabs that we've got to source our project.env files in, this gets tedious.
This morning, Rolf shared with me a way to spawn gnome-terminal and have it automatically cd into a list of specified working-directories... but I wanted to take it a step further and have gnome-terminal auto-magically source my project environment variables.
Here's how I solved this problem:
* Step 1: Create a ~/bin/devterms shell script:
#!/bin/bash -e MONO_ENV="/bin/bash --rcfile ~/.devtermsrc -i" gnome-terminal \ --tab --working-directory=/cvs/moon --command="$MONO_ENV" \ --tab --working-directory=/cvs/moon/test --command="$MONO_ENV" \ --tab --working-directory=/cvs/mono --command="$MONO_ENV" \ --tab --working-directory=/cvs/monodevelop --command="$MONO_ENV" \ &
* Step 2: Create ~/.devtermsrc rc file for bash:
# Load ~/.bashrc to setup all of my standard environment variables and aliases test -s ~/.bashrc && . ~/.bashrc || true # Load Mono-specific development environment variables test -s ~/mono.env && . ~/mono.env || true
* Step 3: Create a launcher (in my case, I made ~/Desktop/Development Environment.desktop):
[Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Terminal=false Name[en_US]=Development Environment Exec=/home/fejj/bin/devterms Name=Development Environment Icon=gnome-terminal
Hopefully this will help other people make their own lives a little simpler.