dynamic window titles

This commit is contained in:
Daniel Micay 2012-05-22 08:22:31 -04:00
parent 15301007c5
commit 5959961302
2 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <stdbool.h> #include <stdbool.h>
#define URGENT_ON_BEEP #define URGENT_ON_BEEP
#define DYNAMIC_TITLE
static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*"; static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*";
static const char *url_command = "/usr/bin/firefox"; static const char *url_command = "/usr/bin/firefox";

11
term.c
View File

@ -136,6 +136,13 @@ static void beep_handler(__attribute__((unused)) VteTerminal *vte, GtkWidget *wi
} }
#endif #endif
#ifdef DYNAMIC_TITLE
static void window_title_cb(VteTerminal *vte, GtkWindow *window) {
const char *t = vte_terminal_get_window_title(vte);
gtk_window_set_title(window, t ? t : "term");
}
#endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
GError *error = NULL; GError *error = NULL;
@ -222,6 +229,10 @@ int main(int argc, char **argv) {
} }
#endif #endif
#ifdef DYNAMIC_TITLE
g_signal_connect(vte, "window-title-changed", G_CALLBACK(window_title_cb), window);
#endif
gtk_widget_show_all(window); gtk_widget_show_all(window);
gtk_main(); gtk_main();
return 0; return 0;