sites

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

commit f960069460d7578b36adcbfcca706cda8c337d98
parent 5c118056d13c5eabec1e8cc1fc4d5e7388e4dc5f
Author: Evan Gates <evan.gates@gmail.com>
Date:   Fri, 30 Oct 2009 10:31:19 -0700

useragent patch for surf 0.3 (no real change, just the name, didn't think we'd get a release that quickly), and a small typo fix
Diffstat:
Asurf.suckless.org/patches/surf-0.3-agent.diff | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsurf.suckless.org/patches/surf-2998ef786732-agent.diff | 67-------------------------------------------------------------------
Msurf.suckless.org/patches/useragent.md | 7++-----
3 files changed, 69 insertions(+), 72 deletions(-)

diff --git a/surf.suckless.org/patches/surf-0.3-agent.diff b/surf.suckless.org/patches/surf-0.3-agent.diff @@ -0,0 +1,67 @@ +diff -r 46d516fd2167 config.def.h +--- a/config.def.h Fri Oct 30 13:38:14 2009 +0100 ++++ b/config.def.h Fri Oct 30 10:26:39 2009 -0700 +@@ -29,6 +29,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 46d516fd2167 surf.c +--- a/surf.c Fri Oct 30 13:38:14 2009 +0100 ++++ b/surf.c Fri Oct 30 10:26:39 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/surf-2998ef786732-agent.diff b/surf.suckless.org/patches/surf-2998ef786732-agent.diff @@ -1,67 +0,0 @@ -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 @@ -6,15 +6,12 @@ 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. +through dmenu, or to have a script use xprop and set it for you. Download -------- -* [surf-2998ef786732-agent.diff](surf-2998ef786732-agent.diff) (2.1k) (20091029) +* [surf-0.3-agent.diff](surf-0.3-agent.diff) (2.1k) (20091030) Author ------