Index: src/terminal-screen.c
===================================================================
--- src/terminal-screen.c	(revision 3436)
+++ src/terminal-screen.c	(working copy)
@@ -73,6 +73,7 @@
   double font_scale;
   gboolean user_title; /* title was manually set */
   GSList *match_tags;
+  gboolean bell_raised;
 };
 
 enum
@@ -91,7 +92,8 @@
   PROP_ICON_TITLE_SET,
   PROP_OVERRIDE_COMMAND,
   PROP_TITLE,
-  PROP_INITIAL_ENVIRONMENT
+  PROP_INITIAL_ENVIRONMENT,
+  PROP_BELL_RAISED
 };
 
 enum
@@ -287,6 +289,14 @@
 }
 
 static void
+terminal_screen_set_bell_raised (TerminalScreen *screen,
+                                 gboolean raised)
+{
+  screen->priv->bell_raised = raised;
+  g_object_notify (G_OBJECT (screen), "bell-raised");
+}
+
+static void
 terminal_screen_style_set (GtkWidget *widget,
                            GtkStyle *previous_style)
 {
@@ -322,6 +332,29 @@
 }
 #endif
 
+static gboolean
+terminal_screen_beep_cb (TerminalScreen *screen)
+{
+  terminal_screen_set_bell_raised (screen, TRUE);
+  return FALSE;
+}
+
+/* The user switched to this tab... */
+static gboolean
+terminal_screen_focus_cb (TerminalScreen *screen)
+{
+  terminal_screen_set_bell_raised (screen, FALSE);
+  return FALSE;
+}
+
+/* The user switched to the parent window and this tab was the active one... */
+static gboolean
+terminal_screen_focus_in_event_cb (TerminalScreen *screen)
+{
+  terminal_screen_set_bell_raised (screen, FALSE);
+  return FALSE;
+}
+
 static void
 terminal_screen_init (TerminalScreen *screen)
 {
@@ -381,6 +414,7 @@
 
   priv->override_title = NULL;
   priv->user_title = FALSE;
+  priv->bell_raised = FALSE;
   
   g_signal_connect (screen, "window-title-changed",
                     G_CALLBACK (terminal_screen_window_title_changed),
@@ -394,6 +428,16 @@
 
   g_signal_connect (screen, "parent-set", G_CALLBACK (parent_set_callback), NULL);
 
+  g_signal_connect (screen, "beep",
+                    G_CALLBACK (terminal_screen_beep_cb),
+                    NULL);
+  g_signal_connect (screen, "focus",
+                    G_CALLBACK (terminal_screen_focus_cb),
+                    NULL);
+  g_signal_connect (screen, "focus-in-event",
+                    G_CALLBACK (terminal_screen_focus_in_event_cb),
+                    NULL);
+
 #ifdef GNOME_ENABLE_DEBUG
   _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
     {
@@ -431,6 +475,9 @@
       case PROP_TITLE:
         g_value_set_string (value, terminal_screen_get_title (screen));
         break;
+      case PROP_BELL_RAISED:
+        g_value_set_boolean (value, terminal_screen_get_bell_raised (screen));
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -461,6 +508,9 @@
       case PROP_INITIAL_ENVIRONMENT:
         terminal_screen_set_initial_environment (screen, g_value_get_boxed (value));
         break;
+      case PROP_BELL_RAISED:
+        terminal_screen_set_bell_raised (screen, g_value_get_boolean (value));
+        break;
       case PROP_ICON_TITLE:
       case PROP_ICON_TITLE_SET:
       case PROP_TITLE:
@@ -576,6 +626,14 @@
                          G_TYPE_STRV,
                          G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 
+  g_object_class_install_property
+    (object_class,
+     PROP_BELL_RAISED,
+     g_param_spec_boolean ("bell-raised", NULL, NULL,
+                           FALSE,
+                           G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+
   g_type_class_add_private (object_class, sizeof (TerminalScreenPrivate));
 
   /* Precompile the regexes */
@@ -2314,3 +2372,10 @@
   return TRUE;
 #endif
 }
+
+gboolean
+terminal_screen_get_bell_raised (TerminalScreen *screen)
+{
+  return screen->priv->bell_raised;
+}
+
Index: src/terminal-screen.h
===================================================================
--- src/terminal-screen.h	(revision 3436)
+++ src/terminal-screen.h	(working copy)
@@ -131,6 +131,8 @@
 
 gboolean terminal_screen_has_foreground_process (TerminalScreen *screen);
 
+gboolean terminal_screen_get_bell_raised (TerminalScreen *screen);
+
 /* 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)
