Index: src/terminal-app.h
===================================================================
--- src/terminal-app.h	(revision 3355)
+++ src/terminal-app.h	(working copy)
@@ -93,6 +93,7 @@
 
 gboolean terminal_app_handle_options (TerminalApp *app,
                                       TerminalOptions *options,
+                                      gboolean no_resume,
                                       GError **error);
 
 void terminal_app_edit_profile (TerminalApp     *app,
Index: src/terminal-options.c
===================================================================
--- src/terminal-options.c	(revision 3355)
+++ src/terminal-options.c	(working copy)
@@ -148,6 +148,12 @@
   return it;
 }
 
+void 
+terminal_options_add_new_window (TerminalOptions *options)
+{
+  ensure_top_tab(options);
+}
+
 static InitialWindow*
 add_new_window (TerminalOptions *options,
                 const char           *profile,
@@ -635,9 +641,11 @@
   TerminalOptions *options = data;
   InitialTab    *it;
 
+#ifndef WITH_SMCLIENT
   /* make sure we have some window in case no options were given */
   if (options->initial_windows == NULL)
     it = ensure_top_tab (options);
+#endif
 
   if (options->execute)
     {
Index: src/terminal-options.h
===================================================================
--- src/terminal-options.h	(revision 3355)
+++ src/terminal-options.h	(working copy)
@@ -95,6 +95,8 @@
                                         GKeyFile *key_file,
                                         GError **error);
 
+void terminal_options_add_new_window (TerminalOptions *options);
+
 void terminal_options_free (TerminalOptions *options);
 
 G_END_DECLS
Index: src/terminal.c
===================================================================
--- src/terminal.c	(revision 3355)
+++ src/terminal.c	(working copy)
@@ -473,7 +473,7 @@
   terminal_app_initialize (options->use_factory);
   g_signal_connect (terminal_app_get (), "quit", G_CALLBACK (gtk_main_quit), NULL);
 
-  terminal_app_handle_options (terminal_app_get (), options, NULL);
+  terminal_app_handle_options (terminal_app_get (), options, FALSE, NULL);
   terminal_options_free (options);
 
   /* Now change directory to $HOME so we don't prevent unmounting, e.g. if the
@@ -498,7 +498,7 @@
 static gboolean
 handle_new_terminal_event (TerminalOptions *options)
 {
-  terminal_app_handle_options (terminal_app_get (), options, NULL);
+  terminal_app_handle_options (terminal_app_get (), options, TRUE, NULL);
 
   return FALSE;
 }
Index: src/terminal-app.c
===================================================================
--- src/terminal-app.c	(revision 3355)
+++ src/terminal-app.c	(working copy)
@@ -1646,6 +1646,7 @@
 gboolean
 terminal_app_handle_options (TerminalApp *app,
                              TerminalOptions *options,
+                             gboolean no_resume,
                              GError **error)
 {
   GList *lw;
@@ -1673,6 +1674,27 @@
       /* fall-through on success */
     }
 
+#ifdef WITH_SMCLIENT
+{
+  EggSMClient *sm_client;
+
+  sm_client = egg_sm_client_get ();
+  if (!no_resume && egg_sm_client_is_resumed (sm_client))
+    {
+      GKeyFile *key_file;
+
+      key_file = egg_sm_client_get_state_file (sm_client);
+      if (key_file)
+	terminal_options_merge_config (options, key_file, error);
+    }
+  /* make sure we have some window in case no options were given */
+  else if (options->initial_windows == NULL)
+    {
+      terminal_options_add_new_window (options);
+    }
+}
+#endif
+
   for (lw = options->initial_windows;  lw != NULL; lw = lw->next)
     {
       InitialWindow *iw = lw->data;
