more flexible url command

This commit is contained in:
Daniel Micay 2012-05-30 13:56:40 -04:00
parent dac26bd406
commit 56c1f04cc6
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@
#ifdef CLICKABLE_URL #ifdef CLICKABLE_URL
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"; #define URL_COMMAND(URL_MATCH) {"/usr/bin/firefox", URL_MATCH, NULL}
#endif #endif
// 0.0: opaque, 1.0: transparent // 0.0: opaque, 1.0: transparent

View File

@ -135,7 +135,7 @@ static char *check_match(VteTerminal *vte, int event_x, int event_y) {
static gboolean button_press_cb(VteTerminal *vte, GdkEventButton *event) { static gboolean button_press_cb(VteTerminal *vte, GdkEventButton *event) {
char *match = check_match(vte, event->x, event->y); char *match = check_match(vte, event->x, event->y);
if (event->button == 1 && event->type == GDK_BUTTON_PRESS && match != NULL) { if (event->button == 1 && event->type == GDK_BUTTON_PRESS && match != NULL) {
const char *argv[3] = {url_command, match, NULL}; const char *argv[] = URL_COMMAND(match);
g_spawn_async(NULL, (char **)argv, NULL, 0, NULL, NULL, NULL, NULL); g_spawn_async(NULL, (char **)argv, NULL, 0, NULL, NULL, NULL, NULL);
g_free(match); g_free(match);
return TRUE; return TRUE;