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) "
4 "Chrome/24.0.1295.0 Safari/537.15 Surf/"VERSION;
5 static char *scriptfile = "~/.surf/script.js";
6 static char *styledir = "~/.surf/styles/";
7 static char *cachedir = "~/.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 enablestyle = TRUE;
34 static Bool loadimages = TRUE;
35 static Bool hidebackground = FALSE;
36 static Bool allowgeolocation = TRUE;
38 static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
39 WEBKIT_FIND_OPTIONS_WRAP_AROUND;
41 #define SETPROP(p, q) { \
42 .v = (char *[]){ "/bin/sh", "-c", \
43 "prop=\"`xprop -id $2 $0 " \
44 "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \
45 "| xargs -0 printf %b | dmenu`\" &&" \
46 "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
51 /* DOWNLOAD(URI, referer) */
52 #define DOWNLOAD(d, r) { \
53 .v = (char *[]){ "/bin/sh", "-c", \
54 "st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \
55 " --referer '$2' -b $3 -c $3 '$0';" \
57 d, useragent, r, cookiefile, NULL \
62 /* This called when some URI which does not begin with "about:",
63 * "http://" or "https://" should be opened.
66 .v = (char *[]){ "/bin/sh", "-c", \
67 "xdg-open \"$0\"", u, NULL \
73 * The iteration will stop at the first match, beginning at the beginning of
76 static SiteStyle styles[] = {
77 /* regexp file in $styledir */
78 { ".*", "default.css" },
81 #define MODKEY GDK_CONTROL_MASK
85 * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
86 * edit the CLEANMASK() macro.
89 /* modifier keyval function arg */
90 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .b = TRUE } },
91 { MODKEY, GDK_KEY_r, reload, { .b = FALSE } },
92 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
94 { MODKEY, GDK_KEY_p, clipboard, { .b = TRUE } },
95 { MODKEY, GDK_KEY_y, clipboard, { .b = FALSE } },
97 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
98 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
99 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
100 { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
101 { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
103 { MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
104 { MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
107 { MODKEY, GDK_KEY_j, scroll_v, { .i = +10 } },
108 { MODKEY, GDK_KEY_k, scroll_v, { .i = -10 } },
109 { MODKEY, GDK_KEY_b, scroll_v, { .i = -50 } },
110 { MODKEY, GDK_KEY_space, scroll_v, { .i = +50 } },
111 { MODKEY, GDK_KEY_i, scroll_h, { .i = +10 } },
112 { MODKEY, GDK_KEY_u, scroll_h, { .i = -10 } },
114 { 0, GDK_KEY_F11, togglefullscreen, { 0 } },
115 { 0, GDK_KEY_Escape, stop, { 0 } },
116 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } },
118 { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
119 { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
120 { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
122 { MODKEY, GDK_KEY_n, find, { .i = +1 } },
123 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
125 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .v = "enable-caret-browsing" } },
126 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .v = "auto-load-images" } },
127 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .v = "enable-scripts" } },
128 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .v = "enable-plugins" } },
129 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
130 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, togglestyle, { 0 } },
131 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, togglegeolocation, { 0 } },
134 /* button definitions */
135 /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
136 static Button buttons[] = {
137 /* target event mask button function argument stop event */
138 { OnLink, 0, 2, linkopenembed, { 0 }, 1 },
139 { OnLink, MODKEY, 2, linkopen, { 0 }, 1 },
140 { OnLink, MODKEY, 1, linkopen, { 0 }, 1 },
141 { OnAny, 0, 8, navigate, { .i = -1 }, 1 },
142 { OnAny, 0, 9, navigate, { .i = +1 }, 1 },