diff options
author | B. Watson <yalhcru@gmail.com> | 2013-07-06 09:40:41 -0400 |
---|---|---|
committer | Niels Horn <niels.horn@slackbuilds.org> | 2013-07-07 09:10:01 -0300 |
commit | 5339c6bc3120a25cda925327f8ad7ff828a31eaf (patch) | |
tree | 528c4cef0b8020136b88a3c64bfdf5075f91bf5e /network/surf/patches | |
parent | 2fac39d6548219137b1df420bc00518378d1c4ce (diff) |
network/surf: Added (minimalist web browser)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'network/surf/patches')
-rw-r--r-- | network/surf/patches/homepage.diff | 15 | ||||
-rw-r--r-- | network/surf/patches/searchengines.diff | 69 | ||||
-rw-r--r-- | network/surf/patches/startfullscreen.diff | 70 |
3 files changed, 154 insertions, 0 deletions
diff --git a/network/surf/patches/homepage.diff b/network/surf/patches/homepage.diff new file mode 100644 index 0000000000000..cd74dc18e9030 --- /dev/null +++ b/network/surf/patches/homepage.diff @@ -0,0 +1,15 @@ +diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c +--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.c 2013-07-03 16:48:40.000000000 -0400 +@@ -1218,8 +1218,11 @@ + default: + usage(); + } ARGEND; ++#define HOMEPAGE "@HOMEPAGE@" + if(argc > 0) + arg.v = argv[0]; ++ else ++ arg.v = HOMEPAGE; + + setup(); + newclient(); diff --git a/network/surf/patches/searchengines.diff b/network/surf/patches/searchengines.diff new file mode 100644 index 0000000000000..97aa6a49221cc --- /dev/null +++ b/network/surf/patches/searchengines.diff @@ -0,0 +1,69 @@ +diff -Naur surf-0.6/config.def.h surf-0.6.patched/config.def.h +--- surf-0.6/config.def.h 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/config.def.h 2013-07-03 16:40:14.000000000 -0400 +@@ -93,3 +93,10 @@ + { MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } }, + }; + ++static SearchEngine searchengines[] = { ++ { "d", "https://duckduckgo.com/html/?q=%s" }, ++ { "g", "https://www.google.com/search?q=%s" }, ++ { "dict", "http://www.thefreedictionary.com/%s" }, ++ { "sb", "http://slackbuilds.org/result/?search=%s&sv=@SLACKVER@" }, ++ { "sw", "http://search.slackware.eu/cgi-bin/search.cgi?rm=search&needle=%s&haystack=2&sver=@SVER@&button-search=Search" }, ++}; +diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c +--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.c 2013-07-03 15:25:44.000000000 -0400 +@@ -76,6 +76,11 @@ + + G_DEFINE_TYPE(CookieJar, cookiejar, SOUP_TYPE_COOKIE_JAR_TEXT) + ++typedef struct { ++ char *token; ++ char *uri; ++} SearchEngine; ++ + static Display *dpy; + static Atom atoms[AtomLast]; + static Client *clients = NULL; +@@ -139,6 +144,7 @@ + static void navigate(Client *c, const Arg *arg); + static Client *newclient(void); + static void newwindow(Client *c, const Arg *arg, gboolean noembed); ++static gchar *parseuri(const gchar *uri); + static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); + static void populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c); + static void popupactivate(GtkMenuItem *menu, Client *); +@@ -627,8 +633,8 @@ + u = g_strdup_printf("file://%s", rp); + free(rp); + } else { +- u = g_strrstr(uri, "://") ? g_strdup(uri) +- : g_strdup_printf("http://%s", uri); ++ u = parseuri(uri); ++ + } + + /* prevents endless loop */ +@@ -893,6 +899,20 @@ + } + } + ++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); ++} ++ + static void + pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) { + Arg arg = {.v = text }; diff --git a/network/surf/patches/startfullscreen.diff b/network/surf/patches/startfullscreen.diff new file mode 100644 index 0000000000000..45e1f87f531ad --- /dev/null +++ b/network/surf/patches/startfullscreen.diff @@ -0,0 +1,70 @@ +diff -Naur surf-0.6/surf.1 surf-0.6.patched/surf.1 +--- surf-0.6/surf.1 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.1 2013-07-03 18:41:35.000000000 -0400 +@@ -50,6 +50,8 @@ + .B \-x + Prints xid to standard output. This can be used to script the browser by using + .BR xprop(1). ++.B \-f ++Start in fullscreen mode. + .SH USAGE + .B Escape + Stops loading current page or stops download. +diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c +--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.c 2013-07-03 18:42:07.000000000 -0400 +@@ -81,6 +81,7 @@ + static Client *clients = NULL; + static GdkNativeWindow embed = 0; + static gboolean showxid = FALSE; ++static gboolean startfullscreen = FALSE; + static char winid[64]; + static gboolean usingproxy = 0; + static char togglestat[5]; +@@ -463,7 +464,7 @@ + } else { + gtk_window_fullscreen(GTK_WINDOW(c->win)); + } +- c->fullscreen = !c->fullscreen; ++ startfullscreen = c->fullscreen = !c->fullscreen; + } + + static const char * +@@ -822,6 +823,9 @@ + } + } + ++ if(startfullscreen) { ++ fullscreen(c, NULL); ++ } + return c; + } + +@@ -846,6 +850,8 @@ + cmd[i++] = "-i"; + if(showxid) + cmd[i++] = "-x"; ++ if(startfullscreen) ++ cmd[i++] = "-f"; + cmd[i++] = "--"; + uri = arg->v ? (char *)arg->v : c->linkhover; + if(uri) +@@ -1148,7 +1154,7 @@ + + static void + usage(void) { +- die("usage: %s [-inpsvx] [-c cookiefile] [-e xid] [-r scriptfile]" ++ die("usage: %s [-inpsvxf] [-c cookiefile] [-e xid] [-r scriptfile]" + " [-t stylefile] [-u useragent] [uri]\n", basename(argv0)); + } + +@@ -1215,6 +1221,9 @@ + case 'x': + showxid = TRUE; + break; ++ case 'f': ++ startfullscreen = TRUE; ++ break; + default: + usage(); + } ARGEND; |