tAdd bindings to send URI to plumb or firefox - surf - customized build of surf, the suckless webkit browser
 (HTM) git clone git://src.adamsgaard.dk/surf
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 8351fce81bead5a71962e7e87908b1a898cccc00
 (DIR) parent 90c835416e14473f0d3931df14f3e9ce6e24e829
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Fri, 14 Feb 2020 19:59:55 +0100
       
       Add bindings to send URI to plumb or firefox
       
       Diffstat:
         M config.def.h                        |       2 +-
         M config.h                            |      19 ++++++++++++++++++-
         M surf.c                              |       3 ++-
       
       3 files changed, 21 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       t@@ -91,7 +91,7 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
         */
        #define PLUMB(u) {\
                .v = (const char *[]){ "/bin/sh", "-c", \
       -             "xdg-open \"$0\"", u, NULL \
       +             "plumb \"$0\"", u, NULL \
                } \
        }
        
 (DIR) diff --git a/config.h b/config.h
       t@@ -95,6 +95,14 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
                } \
        }
        
       +/* PLUMBER(URI) */
       +#define PLUMBER(u) {\
       +        .v = (const char *[]){ "/bin/sh", "-c", \
       +             "plumb \"$(echo $(xprop -id $0 $1 | cut -d '\"' -f2) )\"",\
       +             winid, u, NULL \
       +        } \
       +}
       +
        /* VIDEOPLAY(URI) */
        #define VIDEOPLAY(u) {\
                .v = (const char *[]){ "/bin/sh", "-c", \
       t@@ -112,6 +120,14 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
                } \
        }
        
       +/* FIREFOX(URI) */
       +#define FIREFOX(u) {\
       +        .v = (const char *[]){ "/bin/sh", "-c", \
       +             "firefox \"$(echo $(xprop -id $0 $1 | cut -d '\"' -f2) )\"",\
       +             winid, u, NULL \
       +        } \
       +}
       +
        /* styles */
        /*
         * The iteration will stop at the first match, beginning at the beginning of
       t@@ -142,6 +158,7 @@ static Key keys[] = {
                /* modifier              keyval          function    arg */
                { MODKEY,                GDK_KEY_o,      spawn,      SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
                { MODKEY,                GDK_KEY_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
       +        { MODKEY,                GDK_KEY_f,      spawn,      FIREFOX("_SURF_URI") },
        
                { 0,                     GDK_KEY_Escape, stop,       { 0 } },
                { MODKEY,                GDK_KEY_c,      stop,       { 0 } },
       t@@ -160,7 +177,7 @@ static Key keys[] = {
                { MODKEY,                GDK_KEY_d,      scrollv,    { .i = +50 } },
                { MODKEY|GDK_SHIFT_MASK, GDK_KEY_d,      scrollv,    { .i = +100 } },
                { MODKEY,                GDK_KEY_u,      scrollv,    { .i = -50 } },
       -        { MODKEY|GDK_SHIFT_MASK, GDK_KEY_u,      scrollv,    { .i = -100 } },
       +        { MODKEY|GDK_SHIFT_MASK, GDK_KEY_u,      spawn,      PLUMBER("_SURF_URI") },
                { MODKEY,                GDK_KEY_i,      scrollh,    { .i = +10 } },
        
        
 (DIR) diff --git a/surf.c b/surf.c
       t@@ -1981,10 +1981,11 @@ main(int argc, char *argv[])
                Arg arg;
                Client *c;
        
       -#ifdef __OpenBSD__
       +#ifdef __aOpenBSD__
                char path[128];
                const char* home = getcurrentuserhomedir();
        
       +        /* in new X session: surf doesn't start until another X program has run */
                if (snprintf(path, sizeof(path), "%s/.cache", home) < 0)
                        err(1, "snprintf");
                if (unveil(path, "rwc") == -1)