Hi,

I wanted to post this updated patch for Lorenzo Bolla's bookmark config for
anyone running surf from tip.

Incidentally, I did have to roll back one changeset, the AtomHiLight changes
were giving me trouble.

Overall though, starting to feel a lot faster and stabler - so thanks to
Enno and the rest.

Jeremiah
--- surf/config.def.h	2010-05-19 20:35:21.837581735 -0400
+++ config.def.h	2010-05-19 20:40:02.360892089 -0400
@@ -12,6 +12,18 @@ static time_t sessiontime   = 3600;
 	"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | dmenu`\" &&" \
 	"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
 	p, q, winid, NULL } }
+
+#define BM_PICK(p, q)       { .v = (char *[]){ "/bin/sh", "-c", \
+	"prop=\"`cat ~/.surf/bookmarks | dmenu `\" &&" \
+	"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
+    p, q, winid, NULL } }
+
+#define BM_ADD { .v = (char *[]){ "/bin/sh", "-c", \
+	"(echo `xprop -id $0 _SURF_URI | cut -d '\"' -f 2` && \
+	cat ~/.surf/bookmarks) | sort -u > ~/.surf/bookmarks_new && \
+	mv ~/.surf/bookmarks_new ~/.surf/bookmarks", \
+	winid, NULL } }
+
 #define MODKEY GDK_CONTROL_MASK
 static Key keys[] = {
     /* modifier	            keyval      function    arg             Focus */
@@ -33,4 +45,6 @@ static Key keys[] = {
     { MODKEY,               GDK_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
     { MODKEY,               GDK_n,      find,       { .b = TRUE } },
     { MODKEY|GDK_SHIFT_MASK,GDK_n,      find,       { .b = FALSE } },
+	{ MODKEY,               GDK_b,      spawn,      BM_PICK("_SURF_URI", "_SURF_GO") },
+	{ MODKEY|GDK_SHIFT_MASK,GDK_b,      spawn,      BM_ADD },
 };

Reply via email to