diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index d1b551e..1668ca7 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -2189,3 +2190,52 @@ terminal_screen_check_match (TerminalScreen *screen,
   g_free (match);
   return NULL;
 }
+
+/**
+ *
+ * Returns: the name of the foreground process in UTF-8 encoding, or
+ *   %NULL if the foreground process is the one started with
+ *   terminal_screen_launch_child().
+ */
+gboolean
+terminal_screen_is_process_runnning  (TerminalScreen *screen,
+                                      char **process_name)
+{
+  TerminalScreenPrivate *priv = screen->priv;
+  int master_fd, fgpid;
+
+  master_fd = vte_terminal_get_pty (VTE_TERMINAL (screen));
+  if (master_fd == -1)
+    return FALSE;
+
+  fgpid = tcgetpgrp (master_fd);
+  if (fgpid == -1 || fgpid == priv->child_pid)
+    return FALSE;
+
+  return TRUE;
+
+#if 0
+  char *cmdline, *basename, *name;
+  gsize len;
+  char filename[64];
+
+  g_snprintf (filename, sizeof (filename), "/proc/%d/cmdline", fgpid);
+  if (!g_file_get_contents (filename, &cmdline, &len, NULL))
+    return TRUE;
+
+  basename = g_path_get_basename (cmdline);
+  g_free (cmdline);
+  if (!basename)
+    return TRUE;
+
+  name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
+  g_free (basename);
+  if (!name)
+    return TRUE;
+
+  if (process_name)
+    *process_name = name;
+
+  return TRUE;
+#endif
+}
diff --git a/src/terminal-screen.h b/src/terminal-screen.h
index 4b7b4d5..318cace 100644
--- a/src/terminal-screen.h
+++ b/src/terminal-screen.h
@@ -122,6 +122,9 @@ void       terminal_screen_get_cell_size (TerminalScreen *screen,
 
 void _terminal_screen_update_scrollbar (TerminalScreen *screen);
 
+gboolean terminal_screen_is_process_runnning (TerminalScreen *screen,
+                                              char **process_name);
+
 /* Allow scales a bit smaller and a bit larger than the usual pango ranges */
 #define TERMINAL_SCALE_XXX_SMALL   (PANGO_SCALE_XX_SMALL/1.2)
 #define TERMINAL_SCALE_XXXX_SMALL  (TERMINAL_SCALE_XXX_SMALL/1.2)
diff --git a/src/terminal-window.c b/src/terminal-window.c
index dc3e592..3d2399f 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -2764,15 +2764,10 @@ confirm_close_window_response_cb (GtkWidget *dialog,
 static gboolean
 confirm_close_window (TerminalWindow *window)
 {
-  TerminalWindowPrivate *priv = window->priv;
   GtkWidget *dialog;
   GConfClient *client;
-  gboolean do_confirm;
-  int n;
-
-  n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook));
-  if (n <= 1)
-    return FALSE;
+  gboolean do_confirm, need_confirmation;
+  GList *tabs, *t;
 
   client = gconf_client_get_default ();
   do_confirm = gconf_client_get_bool (client, CONF_GLOBAL_PREFIX "/confirm_window_close", NULL);
@@ -2780,22 +2775,35 @@ confirm_close_window (TerminalWindow *window)
   if (!do_confirm)
     return FALSE;
 
+  need_confirmation = FALSE;
+  tabs = terminal_window_list_screen_containers (window);
+  for (t = tabs; t != NULL; t = t->next)
+    {
+      TerminalScreen *screen;
+
+      screen = terminal_screen_container_get_screen ((GtkWidget *) t->data);
+      if (terminal_screen_is_process_runnning (screen, NULL))
+        {
+          need_confirmation = TRUE;
+          break;
+        }
+    }
+
+  if (!need_confirmation)
+    return FALSE;
+
   dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                    GTK_MESSAGE_WARNING,
                                    GTK_BUTTONS_CANCEL,
-                                   "%s", _("Close all tabs?"));
+                                   "%s", _("CLose window?"));
   gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-			  		    ngettext ("This window has one tab open. Closing "
-						      "the window will close it.",
-						      "This window has %d tabs open. Closing "
-						      "the window will also close all tabs.",
-						      n),
-					    n);
+                                            "%s", _("Some tabs in this window are still running processes. "
+                                                    "Closing the window will kill them."));
 
   gtk_window_set_title (GTK_WINDOW(dialog), ""); 
 
-  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Close All _Tabs"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Close _Window"), GTK_RESPONSE_ACCEPT);
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
 
   g_signal_connect (dialog, "response",
