diff --git a/config b/config index 32ed092..0a7ee01 100644 --- a/config +++ b/config @@ -15,6 +15,7 @@ font = Monospace 9 scrollback_lines = 10000 #search_wrap = true #urgent_on_bell = true +#hyperlinks = false # $BROWSER is used by default if set, with xdg-open as a fallback #browser = xdg-open diff --git a/man/termite.config.5 b/man/termite.config.5 index e99e378..2b3ce03 100644 --- a/man/termite.config.5 +++ b/man/termite.config.5 @@ -18,6 +18,9 @@ Set the default browser for opening links. If its not set, .IP \fIclickable_url\fR Auto-detected URLs can be clicked on to open them in your browser. Only enabled if a browser is configured or detected. +.IP \fIhyperlinks\fR +Enable support for applications to mark text as hyperlinks. Requires +clickable_url to be set. .IP \fIcursor_blink\fR Specify the how the terminal's cursor should behave. Accepts \fBsystem\fR to respect the gtk global configuration, \fBon\fR and diff --git a/termite.cc b/termite.cc index 1a6da2c..a61501d 100644 --- a/termite.cc +++ b/termite.cc @@ -1169,7 +1169,11 @@ gboolean position_overlay_cb(GtkBin *overlay, GtkWidget *widget, GdkRectangle *a gboolean button_press_cb(VteTerminal *vte, GdkEventButton *event, const config_info *info) { if (info->clickable_url && event->type == GDK_BUTTON_PRESS) { +#if VTE_CHECK_VERSION (0, 49, 1) + auto match = make_unique(vte_terminal_hyperlink_check_event(vte, (GdkEvent*)event), g_free); +#else auto match = make_unique(check_match(vte, event), g_free); +#endif if (!match) return FALSE; @@ -1459,6 +1463,9 @@ static void set_config(GtkWindow *window, VteTerminal *vte, GtkWidget *scrollbar vte_terminal_set_mouse_autohide(vte, cfg_bool("mouse_autohide", FALSE)); vte_terminal_set_allow_bold(vte, cfg_bool("allow_bold", TRUE)); vte_terminal_search_set_wrap_around(vte, cfg_bool("search_wrap", TRUE)); +#if VTE_CHECK_VERSION (0, 49, 1) + vte_terminal_set_allow_hyperlink(vte, cfg_bool("hyperlinks", FALSE)); +#endif info->dynamic_title = cfg_bool("dynamic_title", TRUE); info->urgent_on_bell = cfg_bool("urgent_on_bell", TRUE); info->clickable_url = cfg_bool("clickable_url", TRUE);