config.def.h (7717B)
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 *styledir = "~/.config/surf/styles/"; 5 static char *certdir = "~/.cache/surf/certificates/"; 6 static char *cachedir = "~/.cache/surf/cache/"; 7 static char *cookiefile = "~/.cache/surf/cookies.txt"; 8 static char *scriptfiles[] = { 9 "~/.config/surf/scripts/script.js", 10 "~/.config/surf/scripts/link_hints.js", 11 "~/.config/surf/scripts/easier_key.js", 12 }; 13 static char *homepage = "file:///home/kenji/.config/surf/home.html"; 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 [AccessMicrophone] = { { .i = 0 }, }, 24 [AccessWebcam] = { { .i = 0 }, }, 25 [Certificate] = { { .i = 0 }, }, 26 [CaretBrowsing] = { { .i = 0 }, }, 27 [CookiePolicies] = { { .v = "@Aa" }, }, 28 [DarkMode] = { { .i = 1 }, }, 29 [DefaultCharset] = { { .v = "UTF-8" }, }, 30 [DiskCache] = { { .i = 1 }, }, 31 [DNSPrefetch] = { { .i = 0 }, }, 32 [Ephemeral] = { { .i = 0 }, }, 33 [FileURLsCrossAccess] = { { .i = 0 }, }, 34 [FontSize] = { { .i = 12 }, }, 35 [FrameFlattening] = { { .i = 0 }, }, 36 [Geolocation] = { { .i = 0 }, }, 37 [HideBackground] = { { .i = 0 }, }, 38 [Inspector] = { { .i = 0 }, }, 39 [Java] = { { .i = 1 }, }, 40 [JavaScript] = { { .i = 1 }, }, 41 [KioskMode] = { { .i = 0 }, }, 42 [LoadImages] = { { .i = 1 }, }, 43 [MediaManualPlay] = { { .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 /* 60 { "(://|\\.)suckless\\.org(/|$)", { 61 [JavaScript] = { { .i = 0 }, 1 }, 62 }, }, 63 */ 64 }; 65 66 /* default window size: width, height */ 67 static int winsize[] = { 800, 600 }; 68 69 static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE | 70 WEBKIT_FIND_OPTIONS_WRAP_AROUND; 71 72 #define PROMPT_GO "Go:" 73 #define PROMPT_FIND "Find:" 74 75 /* SETPROP(readprop, setprop, prompt)*/ 76 #define SETPROP(r, s, p) { \ 77 .v = (const char *[]){ "/bin/sh", "-c", \ 78 "prop=\"$(printf '%b' \"$(xprop -id $1 "r" " \ 79 "| sed -e 's/^"r"(UTF8_STRING) = \"\\(.*\\)\"/\\1/' " \ 80 " -e 's/\\\\\\(.\\)/\\1/g')\" " \ 81 "| dmenu -p '"p"' -w $1)\" " \ 82 "&& xprop -id $1 -f "s" 8u -set "s" \"$prop\"", \ 83 "surf-setprop", winid, NULL \ 84 } \ 85 } 86 87 /* DOWNLOAD(URI, referer) */ 88 #define DOWNLOAD(u, r) { \ 89 .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\ 90 "curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \ 91 " -e \"$3\" \"$4\"; read", \ 92 "surf-download", useragent, cookiefile, r, u, NULL \ 93 } \ 94 } 95 96 /* PLUMB(URI) */ 97 /* This called when some URI which does not begin with "about:", 98 * "http://" or "https://" should be opened. 99 */ 100 #define PLUMB(u) {\ 101 .v = (const char *[]){ "/bin/sh", "-c", \ 102 "xdg-open \"$0\"", u, NULL \ 103 } \ 104 } 105 106 /* VIDEOPLAY(URI) */ 107 #define VIDEOPLAY(u) {\ 108 .v = (const char *[]){ "/bin/sh", "-c", \ 109 "mpv --really-quiet \"$0\"", u, NULL \ 110 } \ 111 } 112 113 /* styles */ 114 /* 115 * The iteration will stop at the first match, beginning at the beginning of 116 * the list. 117 */ 118 static SiteSpecific styles[] = { 119 /* regexp file in $styledir */ 120 { ".*duckduckgo.com.*", "duckduckgo.css" }, 121 { ".*", "default.css" }, 122 }; 123 124 /* certificates */ 125 /* 126 * Provide custom certificate for urls 127 */ 128 static SiteSpecific certs[] = { 129 /* regexp file in $certdir */ 130 /* 131 { "://suckless\\.org/", "suckless.org.crt" }, 132 */ 133 }; 134 135 #define MODKEY GDK_CONTROL_MASK 136 137 /* hotkeys */ 138 /* 139 * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to 140 * edit the CLEANMASK() macro. 141 */ 142 static Key keys[] = { 143 /* modifier keyval function arg */ 144 { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) }, 145 { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) }, 146 147 { MODKEY, GDK_KEY_w, playexternal, { 0 } }, 148 149 { MODKEY, GDK_KEY_c, stop, { 0 } }, 150 151 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } }, 152 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } }, 153 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } }, 154 { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } }, 155 { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } }, 156 157 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, clipboard, { .i = 1 } }, 158 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_y, clipboard, { .i = 0 } }, 159 160 { MODKEY, GDK_KEY_n, find, { .i = +1 } }, 161 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } }, 162 163 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } }, 164 { MODKEY, GDK_KEY_t, showcert, { 0 } }, 165 166 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } }, 167 { 0, GDK_KEY_F11, togglefullscreen, { 0 } }, 168 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } }, 169 170 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } }, 171 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } }, 172 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } }, 173 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } }, 174 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } }, 175 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } }, 176 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } }, 177 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, 178 { MODKEY|GDK_SHIFT_MASK, GDK_KEY_d, toggle, { .i = DarkMode } }, 179 }; 180 181 /* button definitions */ 182 /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */ 183 static Button buttons[] = { 184 /* target event mask button function argument stop event */ 185 { OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 }, 186 { OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 }, 187 { OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 }, 188 { OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 }, 189 { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 }, 190 { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 }, 191 };