config.def.h (8406B)
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 *certdir = "~/.surf/certificates/"; 7 static char *cachedir = "~/.surf/cache/"; 8 static char *cookiefile = "~/.surf/cookies.txt"; 9 static char **plugindirs = (char*[]){ 10 "~/.surf/plugins/", 11 LIBPREFIX "/mozilla/plugins/", 12 NULL 13 }; 14 15 /* Webkit default features */ 16 /* Highest priority value will be used. 17 * Default parameters are priority 0 18 * Per-uri parameters are priority 1 19 * Command parameters are priority 2 20 */ 21 static Parameter defconfig[ParameterLast] = { 22 /* parameter Arg value priority */ 23 [AcceleratedCanvas] = { { .i = 1 }, }, 24 [AccessMicrophone] = { { .i = 0 }, }, 25 [AccessWebcam] = { { .i = 0 }, }, 26 [Certificate] = { { .i = 0 }, }, 27 [CaretBrowsing] = { { .i = 0 }, }, 28 [CookiePolicies] = { { .v = "@Aa" }, }, 29 [DefaultCharset] = { { .v = "UTF-8" }, }, 30 [DiskCache] = { { .i = 1 }, }, 31 [DNSPrefetch] = { { .i = 0 }, }, 32 [FileURLsCrossAccess] = { { .i = 0 }, }, 33 [FontSize] = { { .i = 12 }, }, 34 [FrameFlattening] = { { .i = 0 }, }, 35 [Geolocation] = { { .i = 0 }, }, 36 [HideBackground] = { { .i = 0 }, }, 37 [Inspector] = { { .i = 0 }, }, 38 [Java] = { { .i = 1 }, }, 39 [JavaScript] = { { .i = 1 }, }, 40 [KioskMode] = { { .i = 0 }, }, 41 [LoadImages] = { { .i = 1 }, }, 42 [MediaManualPlay] = { { .i = 1 }, }, 43 [Plugins] = { { .i = 1 }, }, 44 [PreferredLanguages] = { { .v = (char *[]){ NULL } }, }, 45 [RunInFullscreen] = { { .i = 0 }, }, 46 [ScrollBars] = { { .i = 1 }, }, 47 [ShowIndicators] = { { .i = 1 }, }, 48 [SiteQuirks] = { { .i = 1 }, }, 49 [SmoothScrolling] = { { .i = 0 }, }, 50 [SpellChecking] = { { .i = 0 }, }, 51 [SpellLanguages] = { { .v = ((char *[]){ "en_US", NULL }) }, }, 52 [StrictTLS] = { { .i = 1 }, }, 53 [Style] = { { .i = 1 }, }, 54 [WebGL] = { { .i = 0 }, }, 55 [ZoomLevel] = { { .f = 1.0 }, }, 56 }; 57 58 static UriParameters uriparams[] = { 59 { "(://|\\.)suckless\\.org(/|$)", { 60 [JavaScript] = { { .i = 0 }, 1 }, 61 [Plugins] = { { .i = 0 }, 1 }, 62 }, }, 63 }; 64 65 /* default window size: width, height */ 66 static int winsize[] = { 800, 600 }; 67 68 static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE | 69 WEBKIT_FIND_OPTIONS_WRAP_AROUND; 70 71 #define PROMPT_GO "Go:" 72 #define PROMPT_FIND "Find:" 73 74 /* SETPROP(readprop, setprop, prompt)*/ 75 #define SETPROP(r, s, p) { \ 76 .v = (const char *[]){ "/bin/sh", "-c", \ 77 "prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \ 78 "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \ 79 "| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \ 80 "surf-setprop", winid, r, s, p, NULL \ 81 } \ 82 } 83 84 /* DOWNLOAD(URI, referer) */ 85 #define DOWNLOAD(u, r) { \ 86 .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\ 87 "curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \ 88 " -e \"$3\" \"$4\"; read", \ 89 "surf-download", useragent, cookiefile, r, u, NULL \ 90 } \ 91 } 92 93 /* PLUMB(URI) */ 94 /* This called when some URI which does not begin with "about:", 95 * "http://" or "https://" should be opened. 96 */ 97 #define PLUMB(u) {\ 98 .v = (const char *[]){ "/bin/sh", "-c", \ 99 "xdg-open \"$0\"", u, NULL \ 100 } \ 101 } 102 103 /* VIDEOPLAY(URI) */ 104 #define VIDEOPLAY(u) {\ 105 .v = (const char *[]){ "/bin/sh", "-c", \ 106 "mpv --really-quiet \"$0\"", u, NULL \ 107 } \ 108 } 109 110 /* styles */ 111 /* 112 * The iteration will stop at the first match, beginning at the beginning of 113 * the list. 114 */ 115 static SiteSpecific styles[] = { 116 /* regexp file in $styledir */ 117 { ".*", "default.css" }, 118 }; 119 120 /* certificates */ 121 /* 122 * Provide custom certificate for urls 123 */ 124 static SiteSpecific certs[] = { 125 /* regexp file in $certdir */ 126 { "://suckless\\.org/", "suckless.org.crt" }, 127 }; 128 129 #define MODKEY GDK_CONTROL_MASK 130 131 /* hotkeys */ 132 /* 133 * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to 134 * edit the CLEANMASK() macro. 135 */ 136 static Key keys[] = { 137 /* modifier keyval function arg */ 138 { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) }, 139 { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) }, 140 { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) }, 141 142 { 0, GDK_KEY_Escape, stop, { 0 } }, 143 { MODKEY, GDK_KEY_c, stop, { 0 } }, 144 145 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } }, 146 { MODKEY, GDK_KEY_r, reload, { .i = 0 } }, 147 148 { MODKEY, GDK_KEY_l, navigate, { .i = +1 } }, 149 { MODKEY, GDK_KEY_h, navigate, { .i = -1 } }, 150 151 /* vertical and horizontal scrolling, in viewport percentage */ 152 { MODKEY, GDK_KEY_j, scrollv, { .i = +10 } }, 153 { MODKEY, GDK_KEY_k, scrollv, { .i = -10 } }, 154 { MODKEY, GDK_KEY_space, scrollv, { .i = +50 } }, 155 { MODKEY, GDK_KEY_b, scrollv, { .i = -50 } }, 156 { MODKEY, GDK_KEY_i, scrollh, { .i = +10 } }, 157 { MODKEY, GDK_KEY_u, scrollh, { .i = -10 } }, 158 159 160 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } }, 161 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } }, 162 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } }, 163 { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } }, 164 { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } }, 165 166 { MODKEY, GDK_KEY_p, clipboard, { .i = 1 } }, 167 { MODKEY, GDK_KEY_y, clipboard, { .i = 0 } }, 168 169 { MODKEY, GDK_KEY_n, find, { .i = +1 } }, 170 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } }, 171 172 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } }, 173 { MODKEY, GDK_KEY_t, showcert, { 0 } }, 174 175 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } }, 176 { 0, GDK_KEY_F11, togglefullscreen, { 0 } }, 177 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } }, 178 179 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } }, 180 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } }, 181 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } }, 182 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } }, 183 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } }, 184 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } }, 185 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } }, 186 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } }, 187 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, 188 }; 189 190 /* button definitions */ 191 /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */ 192 static Button buttons[] = { 193 /* target event mask button function argument stop event */ 194 { OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 }, 195 { OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 }, 196 { OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 }, 197 { OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 }, 198 { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 }, 199 { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 }, 200 };