1 /* modifier 0 means no modifier */
2 static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
3 static char *fulluseragent = ""; /* Or override the whole user agent string */
4 static char *scriptfile = "~/.surf/script.js";
5 static char *styledir = "~/.surf/styles/";
6 static char *cachedir = "~/.surf/cache/";
8 static int kioskmode = 0; /* Ignore shortcuts */
9 static int showindicators = 1; /* Show indicators in window title */
10 static int runinfullscreen = 0; /* Run in fullscreen mode by default */
12 static guint defaultfontsize = 12; /* Default font size */
13 static gfloat zoomlevel = 1.0; /* Default zoom level */
15 /* Soup default features */
16 static char *cookiefile = "~/.surf/cookies.txt";
17 static char *cookiepolicies = "Aa@"; /* A: accept all; a: accept nothing,
18 * @: accept no third party */
19 static int strictssl = 0; /* Refuse untrusted SSL connections */
22 static int enablespellchecking = 0;
23 static const char *spellinglanguages[] = { "en_US", NULL };
24 static const char *preferedlanguages[] = { NULL };
26 /* Webkit default features */
27 static int enablescrollbars = 1;
28 static int enablecaretbrowsing = 1;
29 static int enablecache = 1;
30 static int enableplugins = 1;
31 static int enablescripts = 1;
32 static int enableinspector = 1;
33 static int enablestyle = 1;
34 static int loadimages = 1;
35 static int hidebackground = 0;
36 static int allowgeolocation = 1;
37 static int enablednsprefetching = 0;
38 static int enableframeflattening = 0;
40 static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
41 WEBKIT_FIND_OPTIONS_WRAP_AROUND;
43 #define SETPROP(p, q) { \
44 .v = (const char *[]){ "/bin/sh", "-c", \
45 "prop=\"`xprop -id $2 $0 " \
46 "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \
47 "| xargs -0 printf %b | dmenu`\" &&" \
48 "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
53 /* DOWNLOAD(URI, referer) */
54 #define DOWNLOAD(d, r) { \
55 .v = (const char *[]){ "/bin/sh", "-c", \
56 "st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \
57 " --referer '$2' -b $3 -c $3 '$0';" \
59 d, useragent, r, cookiefile, NULL \
64 /* This called when some URI which does not begin with "about:",
65 * "http://" or "https://" should be opened.
68 .v = (const char *[]){ "/bin/sh", "-c", \
69 "xdg-open \"$0\"", u, NULL \
74 #define VIDEOPLAY(u) {\
75 .v = (const char *[]){ "/bin/sh", "-c", \
76 "mpv --really-quiet \"$0\"", u, NULL \
82 * The iteration will stop at the first match, beginning at the beginning of
85 static SiteStyle styles[] = {
86 /* regexp file in $styledir */
87 { ".*", "default.css" },
90 #define MODKEY GDK_CONTROL_MASK
94 * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
95 * edit the CLEANMASK() macro.
98 /* modifier keyval function arg */
99 { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
100 { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
101 { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
103 { 0, GDK_KEY_Escape, stop, { 0 } },
104 { MODKEY, GDK_KEY_c, stop, { 0 } },
106 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .b = 1 } },
107 { MODKEY, GDK_KEY_r, reload, { .b = 0 } },
109 { MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
110 { MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
113 { MODKEY, GDK_KEY_j, scroll_v, { .i = +10 } },
114 { MODKEY, GDK_KEY_k, scroll_v, { .i = -10 } },
115 { MODKEY, GDK_KEY_b, scroll_v, { .i = -50 } },
116 { MODKEY, GDK_KEY_space, scroll_v, { .i = +50 } },
117 { MODKEY, GDK_KEY_i, scroll_h, { .i = +10 } },
118 { MODKEY, GDK_KEY_u, scroll_h, { .i = -10 } },
120 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
121 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
122 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
123 { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
124 { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
126 { MODKEY, GDK_KEY_p, clipboard, { .b = 1 } },
127 { MODKEY, GDK_KEY_y, clipboard, { .b = 0 } },
129 { MODKEY, GDK_KEY_n, find, { .i = +1 } },
130 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
132 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
134 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
135 { 0, GDK_KEY_F11, togglefullscreen, { 0 } },
136 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } },
137 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, togglestyle, { 0 } },
139 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } },
140 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } },
141 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } },
142 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
143 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
144 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } },
145 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
148 /* button definitions */
149 /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
150 static Button buttons[] = {
151 /* target event mask button function argument stop event */
152 { OnLink, 0, 2, clicknewwindow, { .b = 0 }, 1 },
153 { OnLink, MODKEY, 2, clicknewwindow, { .b = 1 }, 1 },
154 { OnLink, MODKEY, 1, clicknewwindow, { .b = 1 }, 1 },
155 { OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
156 { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
157 { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },