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 *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 " \
41 "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \
42 "| xargs -0 printf %b | dmenu`\" &&" \
43 "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
48 /* DOWNLOAD(URI, referer) */
49 #define DOWNLOAD(d, r) { \
50 .v = (char *[]){ "/bin/sh", "-c", \
51 "st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \
52 " --referer '$2' -b $3 -c $3 '$0';" \
54 d, useragent, r, cookiefile, NULL \
59 /* This called when some URI which does not begin with "about:",
60 * "http://" or "https://" should be opened.
63 .v = (char *[]){ "/bin/sh", "-c", \
64 "xdg-open \"$0\"", u, NULL \
70 * The iteration will stop at the first match, beginning at the beginning of
73 static SiteStyle styles[] = {
74 /* regexp file in $styledir */
75 { ".*", "default.css" },
78 #define MODKEY GDK_CONTROL_MASK
82 * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
83 * edit the CLEANMASK() macro.
86 /* modifier keyval function arg Focus */
87 { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
88 { MODKEY, GDK_r, reload, { .b = FALSE } },
89 { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } },
91 { MODKEY, GDK_p, clipboard, { .b = TRUE } },
92 { MODKEY, GDK_y, clipboard, { .b = FALSE } },
94 { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } },
95 { MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 } },
96 { MODKEY|GDK_SHIFT_MASK,GDK_q, zoom, { .i = 0 } },
97 { MODKEY, GDK_minus, zoom, { .i = -1 } },
98 { MODKEY, GDK_plus, zoom, { .i = +1 } },
100 { MODKEY, GDK_l, navigate, { .i = +1 } },
101 { MODKEY, GDK_h, navigate, { .i = -1 } },
103 { MODKEY, GDK_j, scroll_v, { .i = +1 } },
104 { MODKEY, GDK_k, scroll_v, { .i = -1 } },
105 { MODKEY, GDK_b, scroll_v, { .i = -10000 } },
106 { MODKEY, GDK_space, scroll_v, { .i = +10000 } },
107 { MODKEY, GDK_i, scroll_h, { .i = +1 } },
108 { MODKEY, GDK_u, scroll_h, { .i = -1 } },
110 { 0, GDK_F11, fullscreen, { 0 } },
111 { 0, GDK_Escape, stop, { 0 } },
112 { MODKEY, GDK_o, source, { 0 } },
113 { MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
115 { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
116 { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
117 { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
119 { MODKEY, GDK_n, find, { .b = TRUE } },
120 { MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
122 { MODKEY|GDK_SHIFT_MASK,GDK_c, toggle, { .v = "enable-caret-browsing" } },
123 { MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
124 { MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
125 { MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
126 { MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } },
127 { MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
128 { MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
129 { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
132 /* button definitions */
133 /* click can be ClkDoc, ClkLink, ClkImg, ClkMedia, ClkSel, ClkEdit, ClkAny */
134 static Button buttons[] = {
135 /* click event mask button function argument */
136 { ClkLink, 0, 2, linkopenembed, { 0 } },
137 { ClkLink, MODKEY, 2, linkopen, { 0 } },
138 { ClkLink, MODKEY, 1, linkopen, { 0 } },
139 { ClkAny, 0, 8, navigate, { .i = -1 } },
140 { ClkAny, 0, 9, navigate, { .i = +1 } },