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;
+
+  bell_raised = terminal_screen_get_bell_raised (screen);
+  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);
