surf-0.7-omnibar.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
surf-0.7-omnibar.diff (1847B)
---
1 diff --git a/config.def.h b/config.def.h
2 index 93a3d49..05d81de 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -65,6 +65,18 @@ static Bool allowgeolocation = TRUE;
6 } \
7 }
8
9 +#define ONLOAD(u) { \
10 + .v = (char *[]){"/bin/sh", "-c", \
11 + "~/.surf/omnibar addhist \"$0\"", u, NULL \
12 + } \
13 +}
14 +
15 +#define GOTO { \
16 + .v = (char *[]){"/bin/sh", "-c", \
17 + "~/.surf/omnibar goto \"$0\" \"$1\"", winid, "_SURF_GO", NULL \
18 + } \
19 +}
20 +
21 /* styles */
22 /*
23 * The iteration will stop at the first match, beginning at the beginning of
24 @@ -112,7 +124,7 @@ static Key keys[] = {
25 { MODKEY, GDK_o, source, { 0 } },
26 { MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
27
28 - { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
29 + { MODKEY, GDK_g, spawn, GOTO },
30 { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
31 { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
32
33 diff --git a/surf.c b/surf.c
34 index f2170a4..c8fdab3 100644
35 --- a/surf.c
36 +++ b/surf.c
37 @@ -789,11 +789,11 @@ loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c)
38 WebKitWebDataSource *src;
39 WebKitNetworkRequest *request;
40 SoupMessage *msg;
41 - char *uri;
42 + char *uri = geturi(c);
43 + Arg arg;
44
45 switch (webkit_web_view_get_load_status (c->view)) {
46 case WEBKIT_LOAD_COMMITTED:
47 - uri = geturi(c);
48 if (strstr(uri, "https://") == uri) {
49 frame = webkit_web_view_get_main_frame(c->view);
50 src = webkit_web_frame_get_data_source(frame);
51 @@ -809,6 +809,8 @@ loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c)
52 setstyle(c, getstyle(uri));
53 break;
54 case WEBKIT_LOAD_FINISHED:
55 + arg = (Arg)ONLOAD(uri);
56 + spawn(NULL, &arg);
57 c->progress = 100;
58 updatetitle(c);
59 if (diskcache) {