surf

Mahdi's build of surf
git clone git://mahdi.pw/surf.git
Log | Files | Refs | README | LICENSE

surf-bookmarks-20170722-723ff26.diff (1994B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 2e735bf..43ad9ab 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -69,8 +69,9 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
      6  #define SETPROP(r, s, p) { \
      7          .v = (const char *[]){ "/bin/sh", "-c", \
      8               "prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
      9 -             "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
     10 -             "| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
     11 +             "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\" && cat ~/.surf/bookmarks)\" " \
     12 +             "| dmenu -l 10 -p \"$4\" -w $1)\" && " \
     13 +             "xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
     14               "surf-setprop", winid, r, s, p, NULL \
     15          } \
     16  }
     17 @@ -101,6 +102,17 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
     18          } \
     19  }
     20  
     21 +/* BM_ADD(readprop) */
     22 +#define BM_ADD(r) {\
     23 +        .v = (const char *[]){ "/bin/sh", "-c", \
     24 +             "(echo $(xprop -id $0 $1) | cut -d '\"' -f2 " \
     25 +             "| sed 's/.*https*:\\/\\/\\(www\\.\\)\\?//' && cat ~/.surf/bookmarks) " \
     26 +             "| awk '!seen[$0]++' > ~/.surf/bookmarks.tmp && " \
     27 +             "mv ~/.surf/bookmarks.tmp ~/.surf/bookmarks", \
     28 +             winid, r, NULL \
     29 +        } \
     30 +}
     31 +
     32  /* styles */
     33  /*
     34   * The iteration will stop at the first match, beginning at the beginning of
     35 @@ -132,6 +144,7 @@ static Key keys[] = {
     36  	{ MODKEY,                GDK_KEY_g,      spawn,      SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
     37  	{ MODKEY,                GDK_KEY_f,      spawn,      SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
     38  	{ MODKEY,                GDK_KEY_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
     39 +	{ MODKEY,                GDK_KEY_m,      spawn,      BM_ADD("_SURF_URI") },
     40  
     41  	{ 0,                     GDK_KEY_Escape, stop,       { 0 } },
     42  	{ MODKEY,                GDK_KEY_c,      stop,       { 0 } },