Index: src/notification.c
===================================================================
RCS file: /cvs/gnome/zenity/src/notification.c,v
retrieving revision 1.9
diff -u -p -r1.9 notification.c
--- src/notification.c	6 Jul 2005 20:13:11 -0000	1.9
+++ src/notification.c	11 Jul 2005 09:32:00 -0000
@@ -72,12 +69,21 @@ set_scaled_pixbuf (GtkImage *image, GdkP
 static gboolean
 zenity_notification_icon_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
+  zenity_util_focus_terminal (event->time);
+
+  return TRUE;
+}
+
+static gboolean
+zenity_notification_icon_press_exit_callback (GtkWidget *widget, GdkEventButton *event, gpointer data)
+{
   ZenityData *zen_data;
 
   zen_data = data;
 
   zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
   gtk_main_quit ();
+
   return TRUE;
 }
 
@@ -269,10 +278,13 @@ zenity_notification (ZenityData *data, Z
 
   if (notification_data->listen) {
     zenity_notification_listen_on_stdin (data);
+
+    g_signal_connect (tray_icon, "button_press_event",
+		      G_CALLBACK (zenity_notification_icon_press_callback), NULL);
   } else {
     /* if we aren't listening for changes, then close on button_press */
     g_signal_connect (tray_icon, "button_press_event",
-		      G_CALLBACK (zenity_notification_icon_press_callback), data);
+		      G_CALLBACK (zenity_notification_icon_press_exit_callback), data);
   }
 
   gtk_widget_show_all (GTK_WIDGET (tray_icon));
Index: src/util.c
===================================================================
RCS file: /cvs/gnome/zenity/src/util.c,v
retrieving revision 1.18
diff -u -p -r1.18 util.c
--- src/util.c	8 Jul 2005 23:21:34 -0000	1.18
+++ src/util.c	11 Jul 2005 09:32:01 -0000
@@ -359,3 +357,17 @@ zenity_util_show_dialog (GtkWidget *dial
   gtk_widget_show (dialog);
 }
 
+void
+zenity_util_focus_terminal (guint32 timestamp)
+{
+#ifdef GDK_WINDOWING_X11
+  Window xterm = transient_get_xterm_toplevel ();
+  if (xterm != None) {
+    GdkWindow *gdkxterm = gdk_window_foreign_new (xterm);
+    if (gdkxterm) {
+      gdk_window_focus (gdkxterm, timestamp);
+      g_object_unref (G_OBJECT (gdkxterm));
+    }
+  }
+#endif
+}
Index: src/util.h
===================================================================
RCS file: /cvs/gnome/zenity/src/util.h,v
retrieving revision 1.10
diff -u -p -r1.10 util.h
--- src/util.h	16 Feb 2005 10:32:15 -0000	1.10
+++ src/util.h	11 Jul 2005 09:32:01 -0000
@@ -26,7 +26,8 @@ GdkPixbuf *	zenity_util_pixbuf_new_from_
 void		zenity_util_show_help                     (GError        **error);
 gint		zenity_util_return_exit_code 		  (ZenityExitCode value);                      
 void            zenity_util_show_dialog                   (GtkWidget      *widget);
-                               
+void            zenity_util_focus_terminal                (guint32         timestamp);
+
 G_END_DECLS
 
 #endif /* UTIL_H */
