[wiki] [sites] [surf] update bookmarking patch || Alexis Ben Miloud--Josselin
commit b33bdf7afaf1bf67f3d98f4716f426920436475d
Author: Alexis Ben Miloud--Josselin <alexis.bmj_AT_protonmail.com>
Date: Sat Jul 22 22:11:56 2017 +0200
[surf] update bookmarking patch
diff --git a/surf.suckless.org/patches/bookmarking.md b/surf.suckless.org/patches/bookmarking.md
index b9597460..6286fa4e 100644
--- a/surf.suckless.org/patches/bookmarking.md
+++ b/surf.suckless.org/patches/bookmarking.md
_AT_@ -5,12 +5,13 @@ Description
-----------
Uses cat to add all strings from ~/.surf/bookmarks to the input dmenu.
-Ctrl-b is used to add a new bookmark.
+Ctrl-m is used to add a new bookmark.
Download
--------
-* [surf-0.6-bookmarks.diff](surf-0.6-bookmarks.diff) (20130514)
+* [surf-0.6-bookmarks.diff](surf-0.6-bookmarks.diff) (20130514) *Note: use Ctrl-b instead of Ctrl-m.*
+* [surf-bookmarks-20170722-723ff26.diff](surf-bookmarks-20170722-723ff26.diff) (20170722)
Author
------
_AT_@ -18,3 +19,4 @@ stolen from
- Julien Steinhauser <[julien.steinhauser_AT_orange.fr](mailto:julien.steinhauser_AT_orange.fr)>
written into a patch
- blut
+- Alexis Ben Miloud--Josselin (panpo) <[alexis.bmj_AT_protonmail.com](mailto:alexis.bmj_AT_protonmail.com)>
diff --git a/surf.suckless.org/patches/surf-bookmarks-20170722-723ff26.diff b/surf.suckless.org/patches/surf-bookmarks-20170722-723ff26.diff
new file mode 100644
index 00000000..323ba55f
--- /dev/null
+++ b/surf.suckless.org/patches/surf-bookmarks-20170722-723ff26.diff
_AT_@ -0,0 +1,42 @@
+diff --git a/config.def.h b/config.def.h
+index 2e735bf..43ad9ab 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -69,8 +69,9 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
+ #define SETPROP(r, s, p) { \
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
+- "| sed \"s/^$2(STRING) = //;s/^\\"\(.*\)\\"$/\1/\")\" " \
+- "| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
++ "| sed \"s/^$2(STRING) = //;s/^\\"\(.*\)\\"$/\1/\" && cat ~/.surf/bookmarks)\" " \
++ "| dmenu -l 10 -p \"$4\" -w $1)\" && " \
++ "xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
+ "surf-setprop", winid, r, s, p, NULL \
+ } \
+ }
+_AT_@ -101,6 +102,17 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
+ } \
+ }
+
++/* BM_ADD(readprop) */
++#define BM_ADD(r) {\
++ .v = (const char *[]){ "/bin/sh", "-c", \
++ "(echo $(xprop -id $0 $1) | cut -d '\"' -f2 " \
++ "| sed 's/.*https*:\/\/\(www\.\)\?//' && cat ~/.surf/bookmarks) " \
++ "| awk '!seen[$0]++' > ~/.surf/bookmarks.tmp && " \
++ "mv ~/.surf/bookmarks.tmp ~/.surf/bookmarks", \
++ winid, r, NULL \
++ } \
++}
++
+ /* styles */
+ /*
+ * The iteration will stop at the first match, beginning at the beginning of
+_AT_@ -132,6 +144,7 @@ static Key keys[] = {
+ { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
+ { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+ { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
++ { MODKEY, GDK_KEY_m, spawn, BM_ADD("_SURF_URI") },
+
+ { 0, GDK_KEY_Escape, stop, { 0 } },
+ { MODKEY, GDK_KEY_c, stop, { 0 } },
Received on Sat Jul 22 2017 - 22:12:28 CEST
This archive was generated by hypermail 2.3.0
: Sat Jul 22 2017 - 22:13:08 CEST