sites

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

commit 484eddf909d591c117815d3d04372a13ae4bbe9b
parent ec14131d6a650948fc8f7edf269dbb285282a6fb
Author: Evan Gates <evan.gates@gmail.com>
Date:   Thu, 29 Oct 2009 09:55:47 -0700

added useragent patch
Diffstat:
Asurf.suckless.org/patches/surf-2998ef786732-agent.diff | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asurf.suckless.org/patches/useragent.md | 22++++++++++++++++++++++
2 files changed, 89 insertions(+), 0 deletions(-)

diff --git a/surf.suckless.org/patches/surf-2998ef786732-agent.diff b/surf.suckless.org/patches/surf-2998ef786732-agent.diff @@ -0,0 +1,67 @@ +diff -r 2998ef786732 config.def.h +--- a/config.def.h Wed Oct 28 22:22:20 2009 +0100 ++++ b/config.def.h Wed Oct 28 15:14:59 2009 -0700 +@@ -28,6 +28,7 @@ + { MODKEY, GDK_k, scroll, { .i = -1 } }, + { 0, GDK_Escape, stop, { 0 } }, + { MODKEY, GDK_o, source, { 0 } }, ++ { MODKEY, GDK_a, spawn, SETPROP("_SURF_AGENT") }, + { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI") }, + { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND") }, + { MODKEY, GDK_n, find, { .b = TRUE } }, +diff -r 2998ef786732 surf.c +--- a/surf.c Wed Oct 28 22:22:20 2009 +0100 ++++ b/surf.c Wed Oct 28 15:14:59 2009 -0700 +@@ -55,7 +55,7 @@ + } Key; + + static Display *dpy; +-static Atom uriprop, findprop; ++static Atom uriprop, findprop, agentprop; + static SoupCookieJar *cookies; + static SoupSession *session; + static Client *clients = NULL; +@@ -119,6 +119,16 @@ + /* configuration, allows nested code to access above variables */ + #include "config.h" + ++void ++agent(Client *c, const Arg *arg) { ++ const char *s; ++ WebKitWebSettings *settings; ++ ++ s = getatom(c, agentprop); ++ settings = webkit_web_view_get_settings(c->view); ++ g_object_set(G_OBJECT(settings), "user-agent", s, NULL); ++} ++ + char * + buildpath(const char *path) { + char *apath, *p; +@@ -537,6 +547,7 @@ + g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL); + g_free(uri); + setatom(c, findprop, ""); ++ setatom(c, agentprop, useragent); + + c->download = NULL; + c->title = NULL; +@@ -605,6 +616,10 @@ + arg.b = TRUE; + find(c, &arg); + } ++ else if(ev->atom == agentprop) { ++ arg.v = getatom(c, agentprop); ++ agent(c, &arg); ++ } + return GDK_FILTER_REMOVE; + } + } +@@ -692,6 +707,7 @@ + session = webkit_get_default_session(); + uriprop = XInternAtom(dpy, "_SURF_URI", False); + findprop = XInternAtom(dpy, "_SURF_FIND", False); ++ agentprop = XInternAtom(dpy, "_SURF_AGENT", False); + + /* create dirs and files */ + cookiefile = buildpath(cookiefile); diff --git a/surf.suckless.org/patches/useragent.md b/surf.suckless.org/patches/useragent.md @@ -0,0 +1,22 @@ +USER AGENT +========== + +Description +----------- + +This patch adds the _SURF_AGENT xproperty which allows updating surf's useragent +while running. It may be useful to have a file of predefined useragents to pipe +through dmenu, or to have a script user xprop and set it for you. + +The patch is currently for hg tip (changeset 2998ef786732). Once the next +release comes out I'll keep it in sync with releases. + +Download +-------- + +* [surf-2998ef786732-agent.diff](surf-2998ef786732-agent.diff) (2.1k) (20091029) + +Author +------ + +* Evan Gates (emg) <[evan.gates@gmail.com](mailto:evan.gates@gmail.com)>