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
@@ -129,6 +131,11 @@
 static void terminal_screen_icon_title_changed        (VteTerminal *vte_terminal,
                                                        TerminalScreen *screen);
 
+static gboolean terminal_screen_beep_cb (TerminalScreen *screen);
+static gboolean terminal_screen_focus_cb (TerminalScreen *screen);
+static gboolean terminal_screen_focus_in_event_cb (TerminalScreen *screen);
+static gboolean terminal_screen_key_press_event_cb (TerminalScreen *screen);
+
 static void update_color_scheme                      (TerminalScreen *screen);
 
 static gboolean terminal_screen_format_title (TerminalScreen *screen, const char *raw_title, char **old_cooked_title);
@@ -394,6 +401,19 @@
 
   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);
+  g_signal_connect (screen, "key-press-event",
+                    G_CALLBACK (terminal_screen_key_press_event_cb),
+                    NULL);
+
 #ifdef GNOME_ENABLE_DEBUG
   _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
     {
@@ -431,6 +451,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 +484,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 +602,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 */
@@ -661,6 +695,36 @@
   G_OBJECT_CLASS (terminal_screen_parent_class)->finalize (object);
 }
 
+gboolean
+terminal_screen_beep_cb (TerminalScreen *screen)
+{
+  g_object_set (screen, "bell-raised", TRUE, NULL);
+  return FALSE;
+}
+
+/* The user switched to this tab... */
+gboolean
+terminal_screen_focus_cb (TerminalScreen *screen)
+{
+  g_object_set (screen, "bell-raised", FALSE, NULL);
+  return FALSE;
+}
+
+/* The user switched to the parent window and this tab was the active one... */
+gboolean
+terminal_screen_focus_in_event_cb (TerminalScreen *screen)
+{
+  g_object_set (screen, "bell-raised", FALSE, NULL);
+  return FALSE;
+}
+
+gboolean
+terminal_screen_key_press_event_cb (TerminalScreen *screen)
+{
+  g_object_set (screen, "bell-raised", FALSE, NULL);
+  return FALSE;
+}
+
 TerminalScreen *
 terminal_screen_new (TerminalProfile *profile,
                      char           **override_command,
@@ -2314,3 +2378,17 @@
   return TRUE;
 #endif
 }
+
+gboolean
+terminal_screen_get_bell_raised (TerminalScreen *screen)
+{
+  return screen->priv->bell_raised;
+}
+
+void
+terminal_screen_set_bell_raised (TerminalScreen *screen,
+                                 gboolean raised)
+{
+  screen->priv->bell_raised = raised;
+}
+
Index: src/profile-preferences.glade
===================================================================
--- src/profile-preferences.glade	(revision 3436)
+++ src/profile-preferences.glade	(working copy)
@@ -291,6 +291,44 @@
 	      </child>
 
 	      <child>
+		<widget class="GtkCheckButton" id="highlightonbell-checkbutton">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Flash window _icon and bold tab title on bell</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="highlightfocusedonbell-checkbutton">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">..._even if I am working in that tab and window</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
 		<widget class="GtkHBox" id="hbox140">
 		  <property name="visible">True</property>
 		  <property name="homogeneous">False</property>
Index: src/terminal-tab-label.c
===================================================================
--- src/terminal-tab-label.c	(revision 3436)
+++ src/terminal-tab-label.c	(working copy)
@@ -22,6 +22,7 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
+#include "terminal-debug.h"
 #include "terminal-tab-label.h"
 
 #define TERMINAL_TAB_LABEL_GET_PRIVATE(tab_label)(G_TYPE_INSTANCE_GET_PRIVATE ((tab_label), TERMINAL_TYPE_TAB_LABEL, TerminalTabLabelPrivate))
@@ -77,6 +78,32 @@
   gtk_widget_set_tooltip_text (hbox, title);
 }
 
+static void
+screen_bell_raised_tab_label_cb (TerminalScreen *screen,
+                                 GParamSpec *pspec,
+                                 TerminalTabLabel *tab_label)
+{
+  gboolean bell_raised;
+
+  g_object_get (screen, "bell-raised", &bell_raised, NULL);
+
+  if (bell_raised)
+    {
+      gboolean screen_has_focus;
+      gboolean highlight_focused;
+
+      g_object_get (screen, "has-focus", &screen_has_focus, NULL);
+      highlight_focused = terminal_profile_get_property_boolean (
+          terminal_screen_get_profile (screen),
+          TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL);
+
+      if (!screen_has_focus || highlight_focused)
+        terminal_tab_label_set_bold (tab_label, TRUE);
+    }
+  else
+    terminal_tab_label_set_bold (tab_label, FALSE);
+}
+
 /* public functions */
 
 /* Class implementation */
@@ -161,6 +188,9 @@
   g_signal_connect (close_button, "clicked",
 		    G_CALLBACK (close_button_clicked_cb), tab_label);
 
+  g_signal_connect (priv->screen, "notify::bell-raised",
+                    G_CALLBACK (screen_bell_raised_tab_label_cb), tab_label);
+
   gtk_widget_show_all (hbox);
 
   return object;
Index: src/terminal-screen.h
===================================================================
--- src/terminal-screen.h	(revision 3436)
+++ src/terminal-screen.h	(working copy)
@@ -70,6 +70,7 @@
                                int flavour,
                                guint state);
   void (* close_screen)       (TerminalScreen *screen);
+  void (* bell_raised_handler)(TerminalScreen *screen);
 };
 
 GType terminal_screen_get_type (void) G_GNUC_CONST;
@@ -131,6 +132,10 @@
 
 gboolean terminal_screen_has_foreground_process (TerminalScreen *screen);
 
+gboolean terminal_screen_get_bell_raised (TerminalScreen *screen);
+void terminal_screen_set_bell_raised (TerminalScreen *screen,
+                                          gboolean raised);
+
 /* 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)
Index: src/terminal-profile.c
===================================================================
--- src/terminal-profile.c	(revision 3436)
+++ src/terminal-profile.c	(working copy)
@@ -80,6 +80,8 @@
   PROP_USE_THEME_COLORS,
   PROP_VISIBLE_NAME,
   PROP_WORD_CHARS,
+  PROP_HIGHLIGHT_ON_BELL,
+  PROP_HIGHLIGHT_FOCUSED_ON_BELL,
   LAST_PROP
 };
 
@@ -97,6 +99,8 @@
 #define KEY_EXIT_ACTION "exit_action"
 #define KEY_FONT "font"
 #define KEY_FOREGROUND_COLOR "foreground_color"
+#define KEY_HIGHLIGHT_ON_BELL "highlight_on_bell"
+#define KEY_HIGHLIGHT_FOCUSED_ON_BELL "highlight_focused_on_bell_focused"
 #define KEY_LOGIN_SHELL "login_shell"
 #define KEY_PALETTE "palette"
 #define KEY_SCROLL_BACKGROUND "scroll_background"
@@ -131,6 +135,8 @@
 #define DEFAULT_EXIT_ACTION           (TERMINAL_EXIT_CLOSE)
 #define DEFAULT_FONT                  ("Monospace 12")
 #define DEFAULT_FOREGROUND_COLOR      ("#000000")
+#define DEFAULT_HIGHLIGHT_ON_BELL     (FALSE)
+#define DEFAULT_HIGHLIGHT_FOCUSED_ON_BELL (FALSE)
 #define DEFAULT_LOGIN_SHELL           (FALSE)
 #define DEFAULT_NAME                  (NULL)
 #define DEFAULT_PALETTE               (terminal_palettes[TERMINAL_PALETTE_TANGO])
@@ -1286,6 +1292,8 @@
 
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (ALLOW_BOLD, DEFAULT_ALLOW_BOLD, KEY_ALLOW_BOLD);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (DEFAULT_SHOW_MENUBAR, DEFAULT_DEFAULT_SHOW_MENUBAR, KEY_DEFAULT_SHOW_MENUBAR);
+  TERMINAL_PROFILE_PROPERTY_BOOLEAN (HIGHLIGHT_ON_BELL, DEFAULT_HIGHLIGHT_ON_BELL, KEY_HIGHLIGHT_ON_BELL);
+  TERMINAL_PROFILE_PROPERTY_BOOLEAN (HIGHLIGHT_FOCUSED_ON_BELL, DEFAULT_HIGHLIGHT_FOCUSED_ON_BELL, KEY_HIGHLIGHT_FOCUSED_ON_BELL);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (LOGIN_SHELL, DEFAULT_LOGIN_SHELL, KEY_LOGIN_SHELL);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_BACKGROUND, DEFAULT_SCROLL_BACKGROUND, KEY_SCROLL_BACKGROUND);
   TERMINAL_PROFILE_PROPERTY_BOOLEAN (SCROLL_ON_KEYSTROKE, DEFAULT_SCROLL_ON_KEYSTROKE, KEY_SCROLL_ON_KEYSTROKE);
Index: src/terminal-profile.h
===================================================================
--- src/terminal-profile.h	(revision 3436)
+++ src/terminal-profile.h	(working copy)
@@ -80,6 +80,8 @@
 #define TERMINAL_PROFILE_EXIT_ACTION            "exit-action"
 #define TERMINAL_PROFILE_FONT                   "font"
 #define TERMINAL_PROFILE_FOREGROUND_COLOR       "foreground-color"
+#define TERMINAL_PROFILE_HIGHLIGHT_ON_BELL      "highlight-on-bell"
+#define TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL      "highlight-focused-on-bell"
 #define TERMINAL_PROFILE_LOGIN_SHELL            "login-shell"
 #define TERMINAL_PROFILE_NAME                   "name"
 #define TERMINAL_PROFILE_PALETTE                "palette"
Index: src/terminal-window.c
===================================================================
--- src/terminal-window.c	(revision 3436)
+++ src/terminal-window.c	(working copy)
@@ -1345,6 +1345,45 @@
   terminal_window_remove_screen (window, screen);
 }
 
+static void
+screen_bell_raised_window_cb (TerminalScreen *screen,
+                              GParamSpec *pspec,
+                              TerminalWindow *window)
+{
+  gboolean bell_raised;
+
+  g_object_get (screen, "bell-raised", &bell_raised, NULL);
+  if (bell_raised)
+    {
+      gboolean should_highlight;
+
+      should_highlight = terminal_profile_get_property_boolean (
+          terminal_screen_get_profile (screen),
+          TERMINAL_PROFILE_HIGHLIGHT_ON_BELL);
+
+      if (should_highlight)
+        {
+          gboolean has_toplevel_focus;
+          gboolean highlight_focused;
+
+          g_object_get (window,
+                        "has-toplevel-focus", &has_toplevel_focus,
+                        NULL);
+
+          highlight_focused = terminal_profile_get_property_boolean (
+            terminal_screen_get_profile (screen),
+            TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL);
+
+          if (!has_toplevel_focus || highlight_focused)
+            gtk_window_set_urgency_hint (GTK_WINDOW (window), TRUE);
+        }
+    }
+  else
+    {
+      gtk_window_set_urgency_hint (GTK_WINDOW (window), FALSE);
+    }
+}
+
 static gboolean
 terminal_window_accel_activate_cb (GtkAccelGroup  *accel_group,
                                    GObject        *acceleratable,
@@ -1571,6 +1610,13 @@
   terminal_window_update_encoding_menu (window);
 }
 
+static gboolean
+terminal_window_focus_cb (TerminalWindow *window)
+{
+  gtk_window_set_urgency_hint (GTK_WINDOW (window), FALSE);
+  return FALSE;
+}
+
 static void
 terminal_window_init (TerminalWindow *window)
 {
@@ -1873,6 +1919,10 @@
 
   terminal_window_update_size_to_menu (window);
 
+  g_signal_connect (window, "focus-in-event",
+                    G_CALLBACK (terminal_window_focus_cb), NULL);
+
+
   /* We have to explicitly call this, since screen-changed is NOT
    * emitted for the toplevel the first time!
    */
@@ -2601,6 +2651,10 @@
   g_signal_connect (screen, "close-screen",
                     G_CALLBACK (screen_close_cb), window);
 
+  g_signal_connect (screen, "notify::bell-raised",
+                    G_CALLBACK (screen_bell_raised_window_cb), window);
+
+
   update_notebook (window);
 
   update_tab_visibility (window, 0);
@@ -2690,6 +2744,10 @@
                                         G_CALLBACK (screen_close_cb),
                                         window);
 
+  g_signal_handlers_disconnect_by_func (screen,
+                                        G_CALLBACK (screen_bell_raised_window_cb),
+                                        window);
+
   priv->terms--;
 
   update_notebook (window);
Index: src/gnome-terminal.schemas.in
===================================================================
--- src/gnome-terminal.schemas.in	(revision 3436)
+++ src/gnome-terminal.schemas.in	(working copy)
@@ -247,6 +247,41 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-terminal/profiles/Default/highlight_on_bell</key>
+
+      <applyto>/apps/gnome-terminal/profiles/Default/highlight_on_bell</applyto>
+      <owner>gnome-terminal</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Whether to flash the window icon and bold the tab when the terminal emits a bell</short>
+        <long>
+          If true, the X urgency hint will be set on the window
+		  and the tab's title will be made bold when the terminal
+		  emits a bell.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/gnome-terminal/profiles/Default/highlight_focus_on_bell</key>
+
+      <applyto>/apps/gnome-terminal/profiles/Default/highlight_focus_on_bell</applyto>
+      <owner>gnome-terminal</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Whether to highlight the tab and flash the window icon when the terminal emits a bell even if the tab is focused</short>
+        <long>
+          If true and the GNOME Terminal window doesn't have the
+		  focus, the X urgency hint will be set on the window.
+		  If true and the GNOME Terminal tab doesn't have the
+		  focus, the tab's title will made bold.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-terminal/profiles/Default/word_chars</key>
       <applyto>/apps/gnome-terminal/profiles/Default/word_chars</applyto>
       <owner>gnome-terminal</owner>
Index: src/profile-editor.c
===================================================================
--- src/profile-editor.c	(revision 3436)
+++ src/profile-editor.c	(working copy)
@@ -217,6 +217,14 @@
     SET_SENSITIVE ("bell-checkbutton",
                    !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SILENT_BELL));
 
+  if (!prop_name || prop_name == I_(TERMINAL_PROFILE_HIGHLIGHT_ON_BELL))
+    SET_SENSITIVE ("highlightonbell-checkbutton",
+                   !terminal_profile_property_locked (profile, TERMINAL_PROFILE_HIGHLIGHT_ON_BELL));
+
+  if (!prop_name || prop_name == I_(TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL))
+    SET_SENSITIVE ("highlightfocusedonbell-checkbutton",
+                   !terminal_profile_property_locked (profile, TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL));
+
   if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS))
     SET_SENSITIVE ("word-chars-entry",
                    !terminal_profile_property_locked (profile, TERMINAL_PROFILE_WORD_CHARS));
@@ -812,6 +820,8 @@
   CONNECT ("exit-action-combobox", TERMINAL_PROFILE_EXIT_ACTION);
   CONNECT ("font-selector", TERMINAL_PROFILE_FONT);
   CONNECT ("foreground-colorpicker", TERMINAL_PROFILE_FOREGROUND_COLOR);
+  CONNECT ("highlightonbell-checkbutton", TERMINAL_PROFILE_HIGHLIGHT_ON_BELL);
+  CONNECT ("highlightfocusedonbell-checkbutton", TERMINAL_PROFILE_HIGHLIGHT_FOCUSED_ON_BELL);
   CONNECT ("image-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
   CONNECT ("login-shell-checkbutton", TERMINAL_PROFILE_LOGIN_SHELL);
   CONNECT ("profile-name-entry", TERMINAL_PROFILE_VISIBLE_NAME);
Index: help/C/gnome-terminal.xml
===================================================================
--- help/C/gnome-terminal.xml	(revision 3436)
+++ help/C/gnome-terminal.xml	(working copy)
@@ -857,6 +857,25 @@
              </listitem> 
           </varlistentry> 
           <varlistentry> 
+            <term>
+               <guilabel>Flash window icon and bold the tab title on bell</guilabel> </term> 
+            <listitem> 
+                <para>
+                  Select this option to bold the tab title and flash the window icon if the terminal emits a bell.
+                </para>
+             </listitem> 
+          </varlistentry> 
+          <varlistentry> 
+            <term>
+                <guilabel>Flash window icon and bold the tab title on bell even if I'm working in that tab</guilabel> </term> 
+            <listitem> 
+                <para>
+					Select this option to make the above option apply even if the tab is focused
+					(or if the window is focused if there are no tabs).
+                </para>
+             </listitem> 
+          </varlistentry> 
+          <varlistentry> 
              <term> 
                 <guilabel>Select-by-word characters</guilabel> </term> 
              <listitem> 
