From 14bbe5734b507cef9dd57f3e9fd5294fcc3ead1f Mon Sep 17 00:00:00 2001 From: WanderingPenwing Date: Sun, 4 Aug 2024 13:58:03 +0200 Subject: [PATCH] added click link => new tab --- surf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/surf.c b/surf.c index e0a2f6d..5c46f56 100644 --- a/surf.c +++ b/surf.c @@ -292,6 +292,7 @@ static void insert(Client *c, const Arg *a); /* Buttons */ static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h); static void clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h); +static void clicknewtab(Client *c, const Arg *a, WebKitHitTestResult *h); static void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h); static void switch_tab(Client *c, const Arg *a); @@ -375,7 +376,7 @@ void free_tab(Tab *tab) { // Function to add a tab to the clients tab list void add_tab(Client *client, const gchar *uri) { Tab *tab = g_malloc(sizeof(Tab)); - tab->title = g_strdup("untitled"); + tab->title = g_strdup(uri); tab->uri = g_strdup(uri); tab->suspended = false; client->tabs = g_list_append(client->tabs, tab); @@ -2317,6 +2318,13 @@ clicknewwindow(Client *c, const Arg *a, WebKitHitTestResult *h) newwindow(c, &arg, a->i); } +void +clicknewtab(Client *c, const Arg *a, WebKitHitTestResult *h) +{ + gchar *uri = webkit_hit_test_result_get_link_uri(h); + add_tab(c, uri); +} + void clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h) {