Index: src/terminal-options.c
===================================================================
--- src/terminal-options.c	(revision 3436)
+++ src/terminal-options.c	(working copy)
@@ -51,6 +51,7 @@
   it->zoom = 1.0;
   it->zoom_set = FALSE;
   it->active = FALSE;
+  it->attach_window = FALSE;
 
   return it;
 }
@@ -305,19 +306,26 @@
 {
   TerminalOptions *options = data;
   gboolean is_profile_id;
+  InitialWindow *iw;
+  InitialTab *it;
 
+
   is_profile_id = g_str_has_suffix (option_name, "-with-profile-internal-id");
 
   if (options->initial_windows)
     {
-      InitialWindow *iw;
-
       iw = g_list_last (options->initial_windows)->data;
       iw->tabs = g_list_append (iw->tabs, initial_tab_new (value, is_profile_id));
     }
   else
-    add_new_window (options, value, is_profile_id);
+    {
+      iw = add_new_window (options, value, is_profile_id);
+      it = g_list_last(iw->tabs)->data;
 
+      /* Attach to a previous window */
+      it->attach_window = TRUE;
+    }
+
   return TRUE;
 }
 
Index: src/terminal-options.h
===================================================================
--- src/terminal-options.h	(revision 3436)
+++ src/terminal-options.h	(working copy)
@@ -64,6 +64,8 @@
   double zoom;
   guint zoom_set : 1;
   guint active : 1;
+
+  gboolean attach_window;	/* Tell if we attach to a previous window */
 } InitialTab;
 
 typedef struct
Index: src/terminal-app.c
===================================================================
--- src/terminal-app.c	(revision 3436)
+++ src/terminal-app.c	(working copy)
@@ -110,6 +110,7 @@
   gboolean enable_menu_accels;
 
   gboolean use_factory;
+
 };
 
 enum
@@ -138,6 +139,7 @@
 };
 
 static TerminalApp *global_app = NULL;
+static TerminalWindow *current_window = NULL;
 
 #define MONOSPACE_FONT_DIR "/desktop/gnome/interface"
 #define MONOSPACE_FONT_KEY MONOSPACE_FONT_DIR "/monospace_font_name"
@@ -1717,29 +1719,39 @@
   for (lw = options->initial_windows;  lw != NULL; lw = lw->next)
     {
       InitialWindow *iw = lw->data;
-      TerminalWindow *window;
+      TerminalWindow *window = NULL;
       GList *lt;
 
       g_assert (iw->tabs);
 
-      /* Create & setup new window */
-      window = terminal_app_new_window (app, screen);
+      /* Create & setup new window
+       * If we're opening a new tab we simply attach to the latest opened window */
 
-      if (options->startup_id)
-        terminal_window_set_startup_id (window, options->startup_id);
+      if ( lw == options->initial_windows && ((InitialTab *)iw->tabs->data)->attach_window )
+        {
+	  window = current_window;
+        }
+      
+       if ( !window )
+        {
+          window = terminal_app_new_window (app, screen);
+ 
+          if (options->startup_id)
+            terminal_window_set_startup_id (window, options->startup_id);
+ 
+          /* Overwrite the default, unique window role set in terminal_window_init */
+          if (iw->role)
+            gtk_window_set_role (GTK_WINDOW (window), iw->role);
+ 
+          if (iw->force_menubar_state)
+            terminal_window_set_menubar_visible (window, iw->menubar_state);
+ 
+          if (iw->start_fullscreen)
+            gtk_window_fullscreen (GTK_WINDOW (window));
+          if (iw->start_maximized)
+            gtk_window_maximize (GTK_WINDOW (window));
+	}
 
-      /* Overwrite the default, unique window role set in terminal_window_init */
-      if (iw->role)
-        gtk_window_set_role (GTK_WINDOW (window), iw->role);
-
-      if (iw->force_menubar_state)
-        terminal_window_set_menubar_visible (window, iw->menubar_state);
-
-      if (iw->start_fullscreen)
-        gtk_window_fullscreen (GTK_WINDOW (window));
-      if (iw->start_maximized)
-        gtk_window_maximize (GTK_WINDOW (window));
-
       /* Now add the tabs */
       for (lt = iw->tabs; lt != NULL; lt = lt->next)
         {
@@ -1797,6 +1809,15 @@
   return TRUE;
 }
 
+
+static gboolean terminal_app_cur_window_changed (GtkWidget *widget, gpointer data)
+{
+  current_window = TERMINAL_WINDOW(widget);
+
+  return FALSE;
+}
+
+
 TerminalWindow *
 terminal_app_new_window (TerminalApp *app,
                          GdkScreen *screen)
@@ -1809,6 +1830,9 @@
   g_signal_connect (window, "destroy",
                     G_CALLBACK (terminal_window_destroyed), app);
 
+  g_signal_connect (window, "focus-in-event",
+                    G_CALLBACK (terminal_app_cur_window_changed), NULL);
+
   if (screen)
     gtk_window_set_screen (GTK_WINDOW (window), screen);
 
@@ -1867,6 +1891,9 @@
 TerminalWindow *
 terminal_app_get_current_window (TerminalApp *app)
 {
+  if ( !app->windows )
+    return NULL;
+
   return g_list_last (app->windows)->data;
 }
 
