patch-config.h - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
 (HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       patch-config.h
       ---
            1 --- /dev/null   2019-06-08 18:14:46.479402408 +0200
            2 +++ config.h    2019-06-08 18:14:37.992108174 +0200
            3 @@ -0,0 +1,229 @@
            4 +/* modifier 0 means no modifier */
            5 +static int surfuseragent    = 0;  /* Append Surf version to default WebKit user agent */
            6 +static char *fulluseragent  = ""; /* Or override the whole user agent string */
            7 +static char *scriptfile     = "~/.surf/script.js";
            8 +static char *scriptdir      = "~/.surf/script/";
            9 +static char *styledir       = "~/.surf/styles/";
           10 +static char *certdir        = "~/.surf/certificates/";
           11 +static char *cachedir       = "/tmp/.surf/cache/";
           12 +static char *cookiefile     = "/tmp/.surf/cookies.txt";
           13 +
           14 +/* Webkit default features */
           15 +/* Highest priority value will be used.
           16 + * Default parameters are priority 0
           17 + * Per-uri parameters are priority 1
           18 + * Command parameters are priority 2
           19 + */
           20 +static Parameter defconfig[ParameterLast] = {
           21 +       /* parameter                    Arg value       priority */
           22 +       [AcceleratedCanvas]   =       { { .i = 0 },     },
           23 +       [AccessMicrophone]    =       { { .i = 0 },     },
           24 +       [AccessWebcam]        =       { { .i = 0 },     },
           25 +       [Certificate]         =       { { .i = 0 },     },
           26 +       [CaretBrowsing]       =       { { .i = 0 },     },
           27 +       [CookiePolicies]      =       { { .v = "a@A" }, },
           28 +       [DefaultCharset]      =       { { .v = "UTF-8" }, },
           29 +       [DiskCache]           =       { { .i = 1 },     },
           30 +       [DNSPrefetch]         =       { { .i = 0 },     },
           31 +       [FileURLsCrossAccess] =       { { .i = 0 },     },
           32 +       [FontSize]            =       { { .i = 16 },    },
           33 +       [FrameFlattening]     =       { { .i = 0 },     },
           34 +       [Geolocation]         =       { { .i = 0 },     },
           35 +       [HideBackground]      =       { { .i = 0 },     },
           36 +       [Inspector]           =       { { .i = 1 },     },
           37 +       [Java]                =       { { .i = 0 },     },
           38 +       [JavaScript]          =       { { .i = 0 },     },
           39 +       [KioskMode]           =       { { .i = 0 },     },
           40 +       [LoadImages]          =       { { .i = 1 },     },
           41 +       [MediaManualPlay]     =       { { .i = 1 },     },
           42 +       [Plugins]             =       { { .i = 0 },     },
           43 +       [PreferredLanguages]  =       { { .v = (char *[]){ NULL } }, },
           44 +       [RunInFullscreen]     =       { { .i = 0 },     },
           45 +       [ScrollBars]          =       { { .i = 1 },     },
           46 +       [ShowIndicators]      =       { { .i = 1 },     },
           47 +       [SiteQuirks]          =       { { .i = 1 },     },
           48 +       [SmoothScrolling]     =       { { .i = 0 },     },
           49 +       [SpellChecking]       =       { { .i = 0 },     },
           50 +       [SpellLanguages]      =       { { .v = ((char *[]){ "en_US", NULL }) }, },
           51 +       [StrictTLS]           =       { { .i = 1 },     },
           52 +       [Style]               =       { { .i = 1 },     },
           53 +       [UserAgent]           =       { { .v = "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0" },     },
           54 +       [UserScript]          =       { { .i = 1 },     },
           55 +       [WebGL]               =       { { .i = 0 },     },
           56 +       [ZoomLevel]           =       { { .f = 1.0 },   },
           57 +};
           58 +
           59 +static UriParameters uriparams[] = {
           60 +       { "://www\\.instagram\\.com/", {
           61 +         [UserAgent] = { { .v = "Mozilla/5.0 (Android 9; Mobile; rv:67.0.3) Gecko/67.0.3 Firefox/67.0.3" }, 1 },
           62 +       }, },
           63 +       { "://ilmanifesto\\.it/", {
           64 +         [UserAgent] = { { .v = "Googlebot-News" }, 1 },
           65 +       }, },
           66 +       { "://www\\.haaretz\\.com/", {
           67 +         [UserAgent] = { { .v = "Googlebot-News" }, 1 },
           68 +       }, },
           69 +       { "://(mobile\\.)?twitter\\.com/", {
           70 +         [UserAgent] = { { .v = "curl/7.67.0" }, 1 },
           71 +       }, },
           72 +       { "://www\\.youtube\\.com/", {
           73 +         [UserAgent] = { { .v = "curl/7.67.0" }, 1 },
           74 +       }, },
           75 +};
           76 +
           77 +/* default window size: width, height */
           78 +static int winsize[] = { 800, 600 };
           79 +
           80 +static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
           81 +                                    WEBKIT_FIND_OPTIONS_WRAP_AROUND;
           82 +
           83 +#define PROMPT_GO   "Go:"
           84 +#define PROMPT_FIND "Find:"
           85 +
           86 +/* SETPROP(readprop, setprop, prompt)*/
           87 +#define SETPROP(r, s, p) { \
           88 +        .v = (const char *[]){ "/bin/sh", "-c", \
           89 +            "~/.surf/surf-setprop \"$1\" \"$2\" \"$3\" \"$4\"", \
           90 +             "surf-setprop", winid, r, s, p, NULL \
           91 +        } \
           92 +}
           93 +
           94 +/* DOWNLOAD(URI, referer) */
           95 +#define DOWNLOAD(u, r) { \
           96 +        .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
           97 +             "curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
           98 +             " -e \"$3\" \"$4\"; read", \
           99 +             "surf-download", useragent, cookiefile, r, u, NULL \
          100 +        } \
          101 +}
          102 +
          103 +/* PLUMB(URI) */
          104 +/* This called when some URI which does not begin with "about:",
          105 + * "http://" or "https://" should be opened.
          106 + */
          107 +#define PLUMB(u) {\
          108 +        .v = (const char *[]){ "/bin/sh", "-c", \
          109 +             "plumb \"$0\"", u, NULL \
          110 +        } \
          111 +}
          112 +
          113 +/* VIDEOPLAY(URI) */
          114 +#define VIDEOPLAY(u) {\
          115 +        .v = (const char *[]){ "/bin/sh", "-c", \
          116 +             "mpv --really-quiet \"$0\"", u, NULL \
          117 +        } \
          118 +}
          119 +
          120 +/* styles */
          121 +/*
          122 + * The iteration will stop at the first match, beginning at the beginning of
          123 + * the list.
          124 + */
          125 +static SiteSpecific styles[] = {
          126 +       /* regexp                               file in $styledir */
          127 +       { "://www\\.ft\\.com/",                 "economist.css" },
          128 +       { "://www\\.economist\\.com/",          "ft.css" },
          129 +       { "://github\\.com/",                   "github.css" },
          130 +       { "://www\\.internazionale\\.it/",      "internazionale.css" },
          131 +       { "://hackernoon\\.com/",               "medium.css" },
          132 +       { "://medium\\.com/",                   "medium.css" },
          133 +       { "://news\\.ycombinator\\.com/",       "hackernews.css" },
          134 +       { "://www\\.linkedin\\.com/",           "linkedin.css" },
          135 +       { "://nvd\\.nist\\.gov/",               "nvd.css" },
          136 +       { "://www\\.nytimes\\.com/",            "nytimes.css" },
          137 +       { "://www\\.ondarock\\.it/",            "ondarock.css" },
          138 +       { "://stackoverflow\\.com/",            "stackoverflow.css" },
          139 +       { "://www\\.technologyreview\\.com/s/", "technologyreview.css" },
          140 +       { "://www\\.theverge\\.com/",           "theverge.css" },
          141 +       { "://mobile\\.twitter\\.com/",         "twitter.css" },
          142 +       { "://www\\.wsj\\.com/amp/",            "wsj_amp.css" },
          143 +       { ".*",                                 "default.css" },
          144 +};
          145 +
          146 +/* scripts */
          147 +static SiteSpecific scripts[] = {
          148 +       /* regexp               file in $scriptdir */
          149 +       { "://twitter\\.com/",  "twitter.js" },
          150 +       { ".*",                 "default.js" },
          151 +};
          152 +
          153 +/* certificates */
          154 +/*
          155 + * Provide custom certificate for urls
          156 + */
          157 +static SiteSpecific certs[] = {
          158 +       /* regexp               file in $certdir */
          159 +       { "://suckless\\.org/", "suckless.org.crt" },
          160 +};
          161 +
          162 +#define MODKEY GDK_CONTROL_MASK
          163 +
          164 +/* hotkeys */
          165 +/*
          166 + * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
          167 + * edit the CLEANMASK() macro.
          168 + */
          169 +static Key keys[] = {
          170 +       /* modifier              keyval          function    arg */
          171 +       { MODKEY,                GDK_KEY_g,      spawn,      SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
          172 +       { MODKEY,                GDK_KEY_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
          173 +       { MODKEY,                GDK_KEY_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
          174 +
          175 +       { 0,                     GDK_KEY_Escape, stop,       { 0 } },
          176 +       { MODKEY,                GDK_KEY_c,      stop,       { 0 } },
          177 +
          178 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r,      reload,     { .i = 1 } },
          179 +       { MODKEY,                GDK_KEY_r,      reload,     { .i = 0 } },
          180 +
          181 +       { MODKEY,                GDK_KEY_l,      navigate,   { .i = +1 } },
          182 +       { MODKEY,                GDK_KEY_h,      navigate,   { .i = -1 } },
          183 +
          184 +       /* vertical and horizontal scrolling, in viewport percentage */
          185 +       { MODKEY,                GDK_KEY_j,      scrollv,    { .i = +10 } },
          186 +       { MODKEY,                GDK_KEY_k,      scrollv,    { .i = -10 } },
          187 +       { MODKEY,                GDK_KEY_i,      scrollh,    { .i = +10 } },
          188 +       { MODKEY,                GDK_KEY_u,      scrollh,    { .i = -10 } },
          189 +
          190 +
          191 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j,      zoom,       { .i = -1 } },
          192 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k,      zoom,       { .i = +1 } },
          193 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q,      zoom,       { .i = 0  } },
          194 +       { MODKEY,                GDK_KEY_minus,  zoom,       { .i = -1 } },
          195 +       { MODKEY,                GDK_KEY_plus,   zoom,       { .i = +1 } },
          196 +
          197 +       { MODKEY,                GDK_KEY_p,      clipboard,  { .i = 1 } },
          198 +       { MODKEY,                GDK_KEY_y,      clipboard,  { .i = 0 } },
          199 +
          200 +       { MODKEY,                GDK_KEY_n,      find,       { .i = +1 } },
          201 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n,      find,       { .i = -1 } },
          202 +
          203 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p,      print,      { 0 } },
          204 +       { MODKEY,                GDK_KEY_t,      showcert,   { 0 } },
          205 +
          206 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a,      togglecookiepolicy, { 0 } },
          207 +       { 0,                     GDK_KEY_F11,    togglefullscreen, { 0 } },
          208 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o,      toggleinspector, { 0 } },
          209 +
          210 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c,      toggle,     { .i = CaretBrowsing } },
          211 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_f,      toggle,     { .i = FrameFlattening } },
          212 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g,      toggle,     { .i = Geolocation } },
          213 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s,      toggle,     { .i = JavaScript } },
          214 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i,      toggle,     { .i = LoadImages } },
          215 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_v,      toggle,     { .i = Plugins } },
          216 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b,      toggle,     { .i = ScrollBars } },
          217 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t,      toggle,     { .i = StrictTLS } },
          218 +       { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m,      toggle,     { .i = Style } },
          219 +};
          220 +
          221 +/* button definitions */
          222 +/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
          223 +static Button buttons[] = {
          224 +       /* target       event mask             button  function        argument        stop event */
          225 +       { OnLink,       0,                     2,      clicknewwindow, { .i = 0 },     1 },
          226 +       { OnLink,       GDK_SHIFT_MASK,        1,      clicknewwindow, { .i = 0 },     1 },
          227 +       { OnLink,       MODKEY|GDK_SHIFT_MASK, 1,      clicknewwindow, { .i = 1 },     1 },
          228 +       { OnAny,        0,                     8,      clicknavigate,  { .i = -1 },    1 },
          229 +       { OnAny,        0,                     9,      clicknavigate,  { .i = +1 },    1 },
          230 +       { OnMedia,      MODKEY,                1,      clickexternplayer, { 0 },       1 },
          231 +       { OnAny,        MODKEY,                1,      clickplumb,        { 0 },       1 },
          232 +};