[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Thu, 29 Oct 2009 16:55:55 +0000 (UTC)

changeset: 333:f608a217dc32
tag: tip
user: Evan Gates <evan.gates_AT_gmail.com>
date: Thu Oct 29 09:55:47 2009 -0700
files: surf.suckless.org/patches/surf-2998ef786732-agent.diff surf.suckless.org/patches/useragent.md
description:
added useragent patch


diff -r dd9c3de53755 -r f608a217dc32 surf.suckless.org/patches/surf-2998ef786732-agent.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/surf.suckless.org/patches/surf-2998ef786732-agent.diff Thu Oct 29 09:55:47 2009 -0700
_AT_@ -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
+_AT_@ -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
+_AT_@ -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;
+_AT_@ -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;
+_AT_@ -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;
+_AT_@ -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;
+ }
+ }
+_AT_@ -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 -r dd9c3de53755 -r f608a217dc32 surf.suckless.org/patches/useragent.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/surf.suckless.org/patches/useragent.md Thu Oct 29 09:55:47 2009 -0700
_AT_@ -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_AT_gmail.com](mailto:evan.gates_AT_gmail.com)>
Received on Thu Oct 29 2009 - 17:55:55 CET

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:30:57 CEST