1 /* modifier 0 means no modifier */
2 static char *useragent = "Mozilla/5.0 (X11; U; Unix; en-US) "
3 "AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 "
4 "Safari/537.15 Surf/"VERSION;
5 static char *scriptfile = "~/.surf/script.js";
6 static char *styledir = "~/.surf/styles/";
7 static char *cachefolder = "~/.surf/cache/";
9 static Bool kioskmode = FALSE; /* Ignore shortcuts */
10 static Bool showindicators = TRUE; /* Show indicators in window title */
11 static Bool zoomto96dpi = TRUE; /* Zoom pages to always emulate 96dpi */
12 static Bool runinfullscreen = FALSE; /* Run in fullscreen mode by default */
14 static guint defaultfontsize = 12; /* Default font size */
15 static gfloat zoomlevel = 1.0; /* Default zoom level */
17 /* Soup default features */
18 static char *cookiefile = "~/.surf/cookies.txt";
19 static char *cookiepolicies = "Aa@"; /* A: accept all; a: accept nothing,
20 @: accept no third party */
21 static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
22 static Bool strictssl = FALSE; /* Refuse untrusted SSL connections */
23 static time_t sessiontime = 3600;
25 /* Webkit default features */
26 static Bool enablescrollbars = TRUE;
27 static Bool enablespatialbrowsing = TRUE;
28 static Bool enablediskcache = TRUE;
29 static int diskcachebytes = 5 * 1024 * 1024;
30 static Bool enableplugins = TRUE;
31 static Bool enablescripts = TRUE;
32 static Bool enableinspector = TRUE;
33 static Bool enablestyles = TRUE;
34 static Bool loadimages = TRUE;
35 static Bool hidebackground = FALSE;
36 static Bool allowgeolocation = TRUE;
38 #define SETPROP(p, q) { \
39 .v = (char *[]){ "/bin/sh", "-c", \
40 "prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf %b | dmenu`\" &&" \
41 "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
46 /* DOWNLOAD(URI, referer) */
47 #define DOWNLOAD(d, r) { \
48 .v = (char *[]){ "/bin/sh", "-c", \
49 "st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \
50 " --referer '$2' -b $3 -c $3 '$0';" \
52 d, useragent, r, cookiefile, NULL \
57 /* This called when some URI which does not begin with "about:",
58 * "http://" or "https://" should be opened.
61 .v = (char *[]){ "/bin/sh", "-c", \
62 "xdg-open \"$0\"", u, NULL \
68 * The iteration will stop at the first match, beginning at the beginning of
71 static SiteStyle styles[] = {
72 /* regexp file in $styledir */
73 { ".*", "default.css" },
76 #define MODKEY GDK_CONTROL_MASK
80 * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
81 * edit the CLEANMASK() macro.
84 /* modifier keyval function arg Focus */
85 { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
86 { MODKEY, GDK_r, reload, { .b = FALSE } },
87 { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } },
89 { MODKEY, GDK_p, clipboard, { .b = TRUE } },
90 { MODKEY, GDK_y, clipboard, { .b = FALSE } },
92 { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } },
93 { MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 } },
94 { MODKEY|GDK_SHIFT_MASK,GDK_q, zoom, { .i = 0 } },
95 { MODKEY, GDK_minus, zoom, { .i = -1 } },
96 { MODKEY, GDK_plus, zoom, { .i = +1 } },
98 { MODKEY, GDK_l, navigate, { .i = +1 } },
99 { MODKEY, GDK_h, navigate, { .i = -1 } },
101 { MODKEY, GDK_j, scroll_v, { .i = +1 } },
102 { MODKEY, GDK_k, scroll_v, { .i = -1 } },
103 { MODKEY, GDK_b, scroll_v, { .i = -10000 } },
104 { MODKEY, GDK_space, scroll_v, { .i = +10000 } },
105 { MODKEY, GDK_i, scroll_h, { .i = +1 } },
106 { MODKEY, GDK_u, scroll_h, { .i = -1 } },
108 { 0, GDK_F11, fullscreen, { 0 } },
109 { 0, GDK_Escape, stop, { 0 } },
110 { MODKEY, GDK_o, source, { 0 } },
111 { MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
113 { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
114 { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
115 { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
117 { MODKEY, GDK_n, find, { .b = TRUE } },
118 { MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
120 { MODKEY|GDK_SHIFT_MASK,GDK_c, toggle, { .v = "enable-caret-browsing" } },
121 { MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
122 { MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
123 { MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
124 { MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } },
125 { MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
126 { MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
127 { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
130 /* button definitions */
131 /* click can be ClkDoc, ClkLink, ClkImg, ClkMedia, ClkSel, ClkEdit, ClkAny */
132 static Button buttons[] = {
133 /* click event mask button function argument */
134 { ClkLink, 0, 2, linkopenembed, { 0 } },
135 { ClkLink, MODKEY, 2, linkopen, { 0 } },
136 { ClkLink, MODKEY, 1, linkopen, { 0 } },
137 { ClkAny, 0, 8, navigate, { .i = -1 } },
138 { ClkAny, 0, 9, navigate, { .i = +1 } },