Index: terminal-widget.c
===================================================================
--- terminal-widget.c	(revision 26983)
+++ terminal-widget.c	(working copy)
@@ -80,6 +80,10 @@
 static void     terminal_widget_class_init            (TerminalWidgetClass  *klass);
 static void     terminal_widget_init                  (TerminalWidget       *widget);
 static void     terminal_widget_finalize              (GObject              *object);
+static void     terminal_widget_beep                  (TerminalWidget       *widget);
+static gboolean terminal_widget_focus_in              (TerminalWidget       *widget,
+                                                       GdkEventFocus        *event,
+                                                       gpointer              data);
 static gboolean terminal_widget_button_press_event    (GtkWidget            *widget,
                                                        GdkEventButton       *event);
 static void     terminal_widget_drag_data_received    (GtkWidget            *widget,
@@ -195,6 +199,12 @@
 
   /* apply the initial misc-highlight-urls setting */
   terminal_widget_update_highlight_urls (widget);
+
+  /* handle vte ringing the bell */
+  g_signal_connect_swapped (G_OBJECT (widget), "beep",
+                            G_CALLBACK (terminal_widget_beep), widget);
+  g_signal_connect_swapped (G_OBJECT (widget), "focus-in-event",
+                            G_CALLBACK (terminal_widget_focus_in), widget);
 }
 
 
@@ -214,7 +224,32 @@
 }
 
 
+static void
+terminal_widget_beep (TerminalWidget *widget)
+{
+  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  {
+    GdkWindow *window = widget->__parent__.widget.window;
+    GdkWindow *toplevel = gdk_window_get_toplevel (window);
+    gdk_window_set_urgency_hint (toplevel, TRUE);
+  }
+}
 
+
+static gboolean
+terminal_widget_focus_in (TerminalWidget *widget,
+                          GdkEventFocus *event,
+                          gpointer data)
+{
+  GdkWindow *window = widget->__parent__.widget.window;
+  GdkWindow *toplevel = gdk_window_get_toplevel (window);
+  gdk_window_set_urgency_hint (toplevel, FALSE);
+
+  /* don't stop event propagation - allow VTE to handle it too */
+  return FALSE;
+}
+
+
 static void
 terminal_widget_context_menu_copy (TerminalWidget *widget,
                                    GtkWidget      *item)
