diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 7d65d16..edb4d31 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -213,7 +213,7 @@ config_change_title (void *data, struct t_config_option *option)
     (void) option;
     
     if (CONFIG_BOOLEAN(config_look_set_title))
-	gui_window_title_set ();
+	gui_window_title_set ("");
     else
 	gui_window_title_reset ();
 }
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index ce65711..f192f36 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -133,9 +133,6 @@ gui_main_init ()
                             gui_term_cols, gui_term_lines, 100, 100))
         {
             gui_current_window = gui_windows;
-            
-            if (CONFIG_BOOLEAN(config_look_set_title))
-                gui_window_title_set ();
         }
         
         /* create bar windows for root bars (they were read from config,
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index d60e37f..ebaf339 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -560,6 +560,10 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
         ptr_bar_window->bar->bar_refresh_needed = 1;
     }
     
+    /* Set gui window title to buffer title */ 
+    if (CONFIG_BOOLEAN(config_look_set_title))
+        gui_window_title_set(window->buffer->title);
+
     hook_signal_send ("buffer_switch",
                       WEECHAT_HOOK_SIGNAL_POINTER, buffer);
 }
@@ -1376,18 +1380,16 @@ gui_window_refresh_screen (int full_refresh)
  */
 
 void
-gui_window_title_set ()
+gui_window_title_set (const char *title)
 {
     char *envterm = getenv ("TERM");
     
     if (envterm)
     {
 	if (strcmp( envterm, "sun-cmd") == 0)
-	    printf ("\033]l%s %s\033\\", PACKAGE_NAME, PACKAGE_VERSION);
+	    printf ("\033]l%s\033\\", title);
 	else if (strcmp(envterm, "hpterm") == 0)
-	    printf ("\033&f0k%dD%s %s",
-                    (int)(strlen(PACKAGE_NAME) + strlen(PACKAGE_VERSION) + 1),
-		    PACKAGE_NAME, PACKAGE_VERSION);
+	    printf ("\033&f0k%dD%s", (int)(strlen(title) + 1), title);
 	/* the following term supports the xterm excapes */
 	else if (strncmp (envterm, "xterm", 5) == 0
 		 || strncmp (envterm, "rxvt", 4) == 0
@@ -1395,12 +1397,12 @@ gui_window_title_set ()
 		 || strcmp (envterm, "aixterm") == 0
 		 || strcmp (envterm, "iris-ansi") == 0
 		 || strcmp (envterm, "dtterm") == 0)
-	    printf ("\33]0;%s %s\7", PACKAGE_NAME, PACKAGE_VERSION);
+	    printf ("\33]0;%s\7", title);
 	else if (strcmp (envterm, "screen") == 0)
 	{
-	    printf ("\033k%s %s\033\\", PACKAGE_NAME, PACKAGE_VERSION);
+	    printf ("\033k%s\033\\", title);
 	    /* tryning to set the title of a backgrounded xterm like terminal */
-	    printf ("\33]0;%s %s\7", PACKAGE_NAME, PACKAGE_VERSION);
+	    printf ("\33]0;%s\7", title);
 	}
     }
 }
diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h
index a5125c0..1db482a 100644
--- a/src/gui/curses/gui-curses.h
+++ b/src/gui/curses/gui-curses.h
@@ -83,7 +83,7 @@ extern void gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg);
 extern void gui_window_set_custom_color_fg (WINDOW *window, int fg);
 extern void gui_window_set_custom_color_bg (WINDOW *window, int bg);
 extern void gui_window_clrtoeol_with_current_bg (WINDOW *window);
-extern void gui_window_title_set ();
+extern void gui_window_title_set (const char *title);
 extern void gui_window_title_reset ();
 
 #endif /* gui-curses.h */
diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c
index 627448c..f3ff8b5 100644
--- a/src/gui/gtk/gui-gtk-window.c
+++ b/src/gui/gtk/gui-gtk-window.c
@@ -790,7 +790,7 @@ gui_window_refresh_screen (int full_refresh)
  */
 
 void
-gui_window_title_set ()
+gui_window_title_set (const char *title)
 {
     /* TODO: write this function for Gtk */
 }
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index f7ebce8..20fee22 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -785,6 +785,11 @@ gui_buffer_set_title (struct t_gui_buffer *buffer, const char *new_title)
     if (buffer->title)
         free (buffer->title);
     buffer->title = (new_title && new_title[0]) ? strdup (new_title) : NULL;
+
+    /* Update gui window title when title changes */
+
+    if (CONFIG_BOOLEAN(config_look_set_title))
+        gui_window_title_set(new_title); 
     
     hook_signal_send ("buffer_title_changed",
                       WEECHAT_HOOK_SIGNAL_POINTER, buffer);
diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h
index ae81801..41fd9fb 100644
--- a/src/gui/gui-window.h
+++ b/src/gui/gui-window.h
@@ -171,7 +171,7 @@ extern void gui_window_switch_down (struct t_gui_window *window);
 extern void gui_window_switch_left (struct t_gui_window *window);
 extern void gui_window_switch_right (struct t_gui_window *window);
 extern void gui_window_refresh_screen (int full_refresh);
-extern void gui_window_title_set ();
+extern void gui_window_title_set (const char *title);
 extern void gui_window_title_reset ();
 extern void gui_window_objects_print_log (struct t_gui_window *window);
 
