| adm | Find | login register |
Pavel Plesov joined: posted: 1 promoted: bookmarked: |
Dynamic tab label changes patch for the evilvte-0.4.5~pre5. Usage (for bash):
# Change the window title of X terminals --- src/config.h.orig 2009-06-29 09:48:33.000000000 +0400 +++ src/config.h 2009-07-10 15:07:15.000000000 +0400 @@ -90,6 +90,7 @@ // #define TAB_NEW_PATH_EQUAL_OLD TRUE // #define TAB_REORDERABLE TRUE // #define TAB_SHOW_INFO_AT_TITLE TRUE +#define TAB_LABEL_DYNAMIC TRUE // #define TABBAR TRUE // #define TABBAR_PLACE TOP /* Options: TOP, BOTTOM, LEFT, RIGHT */ // #define TABBAR_AUTOHIDE TRUE --- src/sakura.c.orig 2009-06-29 09:48:33.000000000 +0400 +++ src/sakura.c 2009-07-10 15:11:28.000000000 +0400 @@ -1121,6 +1121,7 @@ void hide_kbm(); void make_kbm(); void move_kbm(); +void do_title_changed(); #if HOTKEY int key_press_event(GtkWidget *widget, GdkEventKey *event) @@ -2457,6 +2458,10 @@ term->vte = vte_terminal_new(); +#if TAB_LABEL_DYNAMIC + g_signal_connect(VTE_TERMINAL(term->vte), "window-title-changed", do_title_changed, NULL); +#endif + #ifdef SCROLLBAR term->scrollbar = gtk_vscrollbar_new(vte_terminal_get_adjustment(VTE_TERMINAL(term->vte))); #endif @@ -2925,6 +2930,17 @@ #endif } +void do_title_changed() +{ +#if TAB_LABEL_DYNAMIC + current_tab = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))); + term = (struct terminal*)g_object_get_data(G_OBJECT(current_tab), "current_tab"); + + const gchar *label = vte_terminal_get_window_title(VTE_TERMINAL(term->vte)); + gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook), VTE_HBOX, label); +#endif /* #if TAB_LABEL_DYNAMIC */ +} + int main(int argc, char **argv) { #if !EVILVTE_MINIMUM |
| adm | Find | login register |