commit 8d6addfc21c1ce6bd95c52b88b346aed85551bf5
parent ed9a679a982b038fc101f41a9a9e8b49233829bb
Author: fred@localhost.localdomain <unknown>
Date: Thu, 24 Sep 2009 20:45:22 +0200
fixed broken links on cool_programs -- Astrobe
Diffstat:
3 files changed, 123 insertions(+), 0 deletions(-)
diff --git a/surf.suckless.org/patches/index.md b/surf.suckless.org/patches/index.md
@@ -0,0 +1,30 @@
+PATCHES
+=======
+
+diff generation
+---------------
+For mercurial users:
+
+ cd surf-directory
+ hg diff > surf-X.Y-yourpatchname.diff
+
+For tarballs:
+
+ cd modified-surf-directory/..
+ diff -up original-surf-directory modified-surf-directory > surf-X.Y-yourpatchname.diff
+
+where `X.Y` is a surf tag name or version number.
+
+
+patch application
+-----------------
+For mercurial users:
+
+ cd surf-directory
+ hg patch path/to/patch.diff
+
+For tarballs:
+
+ cd surf-directory
+ patch -p1 < path/to/patch.diff
+
diff --git a/surf.suckless.org/patches/searchengines-0.1.diff b/surf.suckless.org/patches/searchengines-0.1.diff
@@ -0,0 +1,61 @@
+diff -r fee97b4579f2 config.def.h
+--- a/config.def.h Mon Sep 21 03:27:20 2009 +0200
++++ b/config.def.h Wed Sep 23 22:58:21 2009 +0200
+@@ -30,3 +30,6 @@
+ { 0, GDK_Return, hideurl, { 0 }, UrlBar },
+ };
+
++static SearchEngine searchengines[] = {
++ { NULL, NULL },
++};
+diff -r fee97b4579f2 surf.c
+--- a/surf.c Mon Sep 21 03:27:20 2009 +0200
++++ b/surf.c Wed Sep 23 22:58:21 2009 +0200
+@@ -58,6 +58,11 @@
+ KeyFocus focus;
+ } Key;
+
++typedef struct {
++ char *token;
++ char *uri;
++} SearchEngine;
++
+ static Display *dpy;
+ static Atom urlprop;
+ static SoupCookieJar *cookiejar;
+@@ -92,6 +97,7 @@
+ static Client *newclient(void);
+ static WebKitWebView *newwindow(WebKitWebView *v, WebKitWebFrame *f, Client *c);
+ static void pasteurl(GtkClipboard *clipboard, const gchar *text, gpointer d);
++static gchar *parseuri(const gchar *uri);
+ static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event, gpointer d);
+ static void print(Client *c, const Arg *arg);
+ static void proccookies(SoupMessage *m, Client *c);
+@@ -348,14 +354,25 @@
+ g_free(uri);
+ }
+
++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
+ loaduri(Client *c, const Arg *arg) {
+ gchar *u;
+ const gchar *uri = (gchar *)arg->v;
+ if(!uri)
+ uri = gtk_entry_get_text(GTK_ENTRY(c->urlbar));
+- u = g_strrstr(uri, "://") ? g_strdup(uri)
+- : g_strdup_printf("http://%s", uri);
++ u = parseuri(uri);
+ webkit_web_view_load_uri(c->view, u);
+ c->progress = 0;
+ c->title = copystr(&c->title, u);
diff --git a/surf.suckless.org/patches/searchengines.md b/surf.suckless.org/patches/searchengines.md
@@ -0,0 +1,32 @@
+SEARCH ENGINES
+============
+
+Description
+-----------
+
+This little patch will allow the use of simple search engines. Put something
+like this in your config.h:
+
+ static SearchEngine searchengines[] = {
+ { "g", "http://www.google.de/search?q=%s" },
+ { "leo", "http://dict.leo.org/ende?search=%s" },
+ };
+
+This will enable searching in your favorit search engine by simply
+putting the prefix of your search engine in front your keywords:
+
+ g foo bar
+
+Or:
+
+ leo hello
+
+Download
+------
+
+* [searchengines-0.1.diff](searchengines-0.1.diff) (4K) (20090923)
+
+Author
+------
+
+- Nils Schweinsberg (McManiaC) <[mail@n-sch.de](mailto:mail@n-sch.de)>