Eu embora, eu posso precisar de tal opção eu mesmo. AFAIK, gnome-terminal
não suporta plug-ins.
Estou usando o Ubuntu 14.04, gnome-terminal 3.6.2. Eu não testei o tempo suficiente, espere erros.
-
Fonte de download & amp; construa dependências
sudo apt-get build-dep gnome-terminal apt-get source gnome-terminal
-
Adicionar suporte para caminhos
src/terminal-screen.h
, adicioneFLAVOR_DEFAULT_TO_FILE
tipo de enum para caminhos de arquivotypedef enum { FLAVOR_AS_IS, FLAVOR_DEFAULT_TO_HTTP, FLAVOR_VOIP_CALL, FLAVOR_EMAIL, FLAVOR_LP, FLAVOR_DEFAULT_TO_FILE } TerminalURLFlavour;
src/terminal-screen.c
, adicione regex de caminho (não é perfeito, pode precisar de algum ajuste)static const TerminalRegexPattern url_regex_patterns[] = { { SCHEME "//(?:" USERPASS "\@)?" HOST PORT URLPATH, FLAVOR_AS_IS, G_REGEX_CASELESS }, { "(?:www|ftp)" HOSTCHARS_CLASS "*\." HOST PORT URLPATH , FLAVOR_DEFAULT_TO_HTTP, G_REGEX_CASELESS }, { "(?:callto:|h323:|sip:)" USERCHARS_CLASS "[" USERCHARS ".]*(?:" PORT "/[a-z0-9]+)?\@" HOST, FLAVOR_VOIP_CALL, G_REGEX_CASELESS }, { "(?:mailto:)?" USERCHARS_CLASS "[" USERCHARS ".]*\@" HOSTCHARS_CLASS "+\." HOST, FLAVOR_EMAIL, G_REGEX_CASELESS }, { "(?:news:|man:|info:)[[:alnum:]\Q^_{|}~!\"#$%&'()*+,./;:=?'\E]+", FLAVOR_AS_IS, G_REGEX_CASELESS }, { "(?:lp: #)[[:digit:]]+", FLAVOR_LP, G_REGEX_CASELESS }, { "((~/)|(\.\./)|(\./)|(/))+[^\n\t\r\v\0 !$'&*()+:]+[^\n\t\r\v\0 !$'&*()+:?.,;\"'\]\[<>#{}(]", FLAVOR_DEFAULT_TO_FILE, G_REGEX_CASELESS }, };
src/terminal-util.c
, componha o URL correto adicionandofile://
prefixswitch (flavor) { case FLAVOR_DEFAULT_TO_HTTP: uri = g_strdup_printf ("http://%s", orig_url); break; case FLAVOR_EMAIL: if (g_ascii_strncasecmp ("mailto:", orig_url, 7) != 0) uri = g_strdup_printf ("mailto:%s", orig_url); else uri = g_strdup (orig_url); break; case FLAVOR_VOIP_CALL: case FLAVOR_AS_IS: uri = g_strdup (orig_url); break; case FLAVOR_LP: uri = terminal_util_get_lp_url (orig_url); break; case FLAVOR_DEFAULT_TO_FILE: uri = g_strdup_printf ("file://%s", orig_url); break; default: uri = NULL; g_assert_not_reached (); }
src/terminal-window.c
, resolver~
e caminhos relativos (./
& amp;../
)static void popup_open_url_callback (GtkAction *action, TerminalWindow *window) { TerminalWindowPrivate *priv = window->priv; TerminalScreenPopupInfo *info = priv->popup_info; if (info == NULL) return; if (info->flavour==FLAVOR_DEFAULT_TO_FILE){ if (info->string[0]=='~') { char* current_dir_full=terminal_util_resolve_relative_path (g_get_home_dir(), &(info->string)[2]); terminal_util_open_url (GTK_WIDGET (window), current_dir_full, info->flavour, gtk_get_current_event_time ()); } else { char* current_dir=terminal_screen_get_current_dir_with_fallback (info->screen); char* current_dir_full=terminal_util_resolve_relative_path (current_dir, info->string); terminal_util_open_url (GTK_WIDGET (window), current_dir_full, info->flavour, gtk_get_current_event_time ()); } } else { terminal_util_open_url (GTK_WIDGET (window), info->string, info->flavour, gtk_get_current_event_time ()); } }
...
show_link = info->string != NULL && (info->flavour == FLAVOR_AS_IS || info->flavour == FLAVOR_DEFAULT_TO_HTTP || info->flavour == FLAVOR_LP || info->flavour == FLAVOR_DEFAULT_TO_FILE );
...
static gboolean screen_match_clicked_cb (TerminalScreen *screen, const char *match, int flavour, guint state, TerminalWindow *window) { TerminalWindowPrivate *priv = window->priv; if (screen != priv->active_screen) return FALSE; gtk_widget_grab_focus (GTK_WIDGET (screen)); if (flavour==FLAVOR_DEFAULT_TO_FILE){ if (match[0]=='~') { char* current_dir_full=terminal_util_resolve_relative_path (g_get_home_dir(), &(match)[2]); terminal_util_open_url (GTK_WIDGET (window), current_dir_full, flavour, gtk_get_current_event_time ()); } else { char* current_dir=terminal_screen_get_current_dir_with_fallback (screen); char* current_dir_full=terminal_util_resolve_relative_path (current_dir, match); terminal_util_open_url (GTK_WIDGET (window), current_dir_full, flavour, gtk_get_current_event_time ()); } } else { terminal_util_open_url (GTK_WIDGET (window), match, flavour, gtk_get_current_event_time ()); } return TRUE; }
-
Criar & amp; instalar
cd gnome-terminal-3.6.2/ ./configure make make install