sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 8b25649cfd09177ca3ffada90870642a18fc9502
parent 14d3b8e90cab3dc6221ec5b6f9f6aee674271f5a
Author: blut <blut.hannes@gmail.com>
Date:   Tue, 14 May 2013 21:47:51 +0200

Update surf searchengies and surf bookmarks

Diffstat:
Asurf.suckless.org/patches/bookmarking.md | 20++++++++++++++++++++
Msurf.suckless.org/patches/searchengines.md | 3+++
Asurf.suckless.org/patches/surf-0.6-bookmarks.diff | 40++++++++++++++++++++++++++++++++++++++++
Asurf.suckless.org/patches/surf-0.6-searchengines.diff | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 134 insertions(+), 0 deletions(-)

diff --git a/surf.suckless.org/patches/bookmarking.md b/surf.suckless.org/patches/bookmarking.md @@ -0,0 +1,20 @@ +Simple bookmarking +================== + +Description +----------- + +Uses cat to add all strings from ~/.surf/bookmarks to the input dmenu. +Ctrl-b is used to add a new bookmark. + +Download +-------- + +* [surf-0.6-bookmarks.diff](surf-0.6-bookmarks.diff) (20130514) + +Author +------ +stolen from +- Julien Steinhauser <[julien.steinhauser@orange.fr](mailto:julien.steinhauser@orange.fr)> +written into a patch +- blut diff --git a/surf.suckless.org/patches/searchengines.md b/surf.suckless.org/patches/searchengines.md @@ -21,6 +21,8 @@ or: leo hello +0.6 patch patches the searchengines array into the config.def.h file. + Download -------- @@ -28,6 +30,7 @@ Download * [surf-0.3-searchengines.diff](surf-0.3-searchengines.diff) (2107) (20091204) * [surf-0.4-searchengines.diff](surf-0.4-searchengines.diff) (2107) (20091204) * [surf-0.5-searchengines.diff](surf-0.5-searchengines.diff) (1611) (20101028) +* [surf-0.6-searchengines.diff](surf-0.6-searchengines.diff) (20130514) Author ------ diff --git a/surf.suckless.org/patches/surf-0.6-bookmarks.diff b/surf.suckless.org/patches/surf-0.6-bookmarks.diff @@ -0,0 +1,40 @@ +diff --git a/config.def.h b/config.def.h +index 08ff707..8185136 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -25,7 +25,8 @@ static Bool allowgeolocation = TRUE; + + #define SETPROP(p, q) { \ + .v = (char *[]){ "/bin/sh", "-c", \ +- "prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf %b | dmenu`\" &&" \ ++ "prop=\"`(xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf %b && "\ ++ "cat ~/.surf/bookmarks) | dmenu`\" &&" \ + "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \ + p, q, winid, NULL \ + } \ +@@ -41,6 +42,12 @@ static Bool allowgeolocation = TRUE; + } \ + } + ++#define BM_ADD { .v = (char *[]){ "/bin/sh", "-c", \ ++ "(echo `xprop -id $0 _SURF_URI | cut -d '\"' -f 2` && \ ++ cat ~/.surf/bookmarks) > ~/.surf/bookmarks_new && \ ++ mv ~/.surf/bookmarks_new ~/.surf/bookmarks", \ ++ winid, NULL } } ++ + #define MODKEY GDK_CONTROL_MASK + + /* hotkeys */ +@@ -72,6 +79,7 @@ static Key keys[] = { + { MODKEY, GDK_space, scroll_v, { .i = +10000 } }, + { MODKEY, GDK_i, scroll_h, { .i = +1 } }, + { MODKEY, GDK_u, scroll_h, { .i = -1 } }, ++ { MODKEY, GDK_b, spawn, BM_ADD }, + + { 0, GDK_F11, fullscreen, { 0 } }, + { 0, GDK_Escape, stop, { 0 } }, +@@ -93,4 +101,3 @@ static Key keys[] = { + { MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars,{ 0 } }, + { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } }, + }; +- diff --git a/surf.suckless.org/patches/surf-0.6-searchengines.diff b/surf.suckless.org/patches/surf-0.6-searchengines.diff @@ -0,0 +1,71 @@ +diff --git a/config.def.h b/config.def.h +index 8185136..6b5144c 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -101,3 +101,10 @@ static Key keys[] = { + { MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars,{ 0 } }, + { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } }, + }; ++ ++static SearchEngine searchengines[] = { ++ { "g", "http://www.google.de/search?q=%s" }, ++ { "en", "http://dict.cc/?s=%s" }, ++ { "ug", "http://%s.uni-goettingen.de" }, ++ { "dict", "http://www.thefreedictionary.com/%s" }, ++}; +diff --git a/surf.c b/surf.c +index da84e1c..7eff5e8 100644 +--- a/surf.c ++++ b/surf.c +@@ -70,6 +70,11 @@ typedef struct { + + 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; +@@ -140,6 +145,7 @@ static void loaduri(Client *c, const Arg *arg); + 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 *); +@@ -629,8 +635,8 @@ loaduri(Client *c, const Arg *arg) { + 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 */ +@@ -911,6 +917,20 @@ popupactivate(GtkMenuItem *menu, Client *c) { + } + } + ++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 };