commit de60be5a43e29414a0afbd282f51671122cec073
Author: Juan Aguilar <aritemeeul_AT_gmail.com>
Date: Fri Jan 8 18:57:23 2016 +0100
Changes to be committed:
modified: surf.suckless.org/patches/searchengines.md
new file: surf.suckless.org/patches/surf-0.7-webkit2-searchengines.diff
diff --git a/surf.suckless.org/patches/searchengines.md b/surf.suckless.org/patches/searchengines.md
index b734b83..05af28a 100644
--- a/surf.suckless.org/patches/searchengines.md
+++ b/surf.suckless.org/patches/searchengines.md
_AT_@ -32,6 +32,7 @@ Download
* [surf-0.5-searchengines.diff](surf-0.5-searchengines.diff) (1611) (20101028)
* [surf-0.6-searchengines.diff](surf-0.6-searchengines.diff) (20130514)
* [surf-0.7-searchengines.diff](surf-0.7-searchengines.diff) (20151219)
+* [surf-0.7-webkit2-searchengines.diff](surf-0.7-webkit2-searchengines.diff) (20160108)
Author
------
_AT_@ -40,3 +41,4 @@ Author
* Samuel Baldwin (shardz) <[recursive.forest_AT_gmail.com](mailto:recursive.forest_AT_gmail.com)>
* Alex Puterbaugh (zombine) <[puterbaugh0_AT_gmail.com](mailto:puterbaugh0_AT_gmail.com)>
* Ivan Tham (pickfire) <[pickfire_AT_riseup.net](mailto:pickfire_AT_riseup.net)>
+* Juan Aguilar Santillana (botika) <[aritmeeul_AT_gmail.com](mailto:aritmeeul_AT_gmail.com)>
diff --git a/surf.suckless.org/patches/surf-0.7-webkit2-searchengines.diff b/surf.suckless.org/patches/surf-0.7-webkit2-searchengines.diff
new file mode 100644
index 0000000..ef94f53
--- /dev/null
+++ b/surf.suckless.org/patches/surf-0.7-webkit2-searchengines.diff
_AT_@ -0,0 +1,63 @@
+diff --git a/surf.c b/surf.c
+index 9b4dbb9..bf54d84 100644
+--- a/surf.c
++++ b/surf.c
+_AT_@ -92,6 +92,12 @@ typedef struct {
+ } Button;
+
+ typedef struct {
++ char *token;
++ char *uri;
++} SearchEngine;
++
++
++typedef struct {
+ char *regex;
+ char *style;
+ regex_t re;
+_AT_@ -124,6 +130,7 @@ static void newwindow(Client *c, const Arg *a, int noembed);
+ static void spawn(Client *c, const Arg *a);
+ static void destroyclient(Client *c);
+ static void cleanup(void);
++static gchar *parseuri(const gchar *uri);
+
+ /* GTK/WebKit */
+ static WebKitWebView *newview(Client *c, WebKitWebView *rv);
+_AT_@ -350,13 +357,13 @@ loaduri(Client *c, const Arg *a)
+ if (g_strcmp0(uri, "") == 0)
+ return;
+
+- if (g_strrstr(uri, "://") || g_str_has_prefix(uri, "about:")) {
++ if (g_str_has_prefix(uri, "about:")) {
+ url = g_strdup(uri);
+ } else if (!stat(uri, &st) && (path = realpath(uri, NULL))) {
+ url = g_strdup_printf("file://%s", path);
+ free(path);
+ } else {
+- url = g_strdup_printf("
http://%s", uri);
++ url = parseuri(uri);
+ }
+
+ setatom(c, AtomUri, url);
+_AT_@ -1205,6 +1212,21 @@ destroywin(GtkWidget* w, Client *c)
+ gtk_main_quit();
+ }
+
++static gchar *
++parseuri(const gchar *uri) {
++ guint i;
++
++ for (i = 0; i < LENGTH(searchengines); i++) {
++ if (searchengines[i].token == NULL || searchengines[i].uri == NULL || \
++ *(uri + strlen(searchengines[i].token)) != ' ')
++ continue;
++ if (g_str_has_prefix(uri, searchengines[i].token))
++ return g_strdup_printf(searchengines[i].uri, uri + strlen(searchengines[i].token) + 1);
++ }
++
++ return g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("
http://%s", uri);
++}
++
+ void
+ pasteuri(GtkClipboard *clipboard, const char *text, gpointer d)
+ {
Received on Fri Jan 08 2016 - 18:58:04 CET