surf-tip-bookmarks.diff (1473B)
1 diff --git a/config.def.h b/config.def.h 2 index 1c18827..4de93c3 100644 3 --- a/config.def.h 4 +++ b/config.def.h 5 @@ -37,9 +37,10 @@ static Bool allowgeolocation = TRUE; 6 7 #define SETPROP(p, q) { \ 8 .v = (char *[]){ "/bin/sh", "-c", \ 9 - "prop=\"`xprop -id $2 $0 " \ 10 + "prop=\"`(xprop -id $2 $0 " \ 11 "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \ 12 - "| xargs -0 printf %b | dmenu`\" &&" \ 13 + "| xargs -0 printf %b &&" \ 14 + "cat ~/.surf/bookmarks)| dmenu`\" &&" \ 15 "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \ 16 p, q, winid, NULL \ 17 } \ 18 @@ -65,6 +66,15 @@ static Bool allowgeolocation = TRUE; 19 } \ 20 } 21 22 +#define BM_ADD { \ 23 + .v = (char *[]){ "/bin/sh", "-c", \ 24 + "(echo `xprop -id $0 _SURF_URI | cut -d '\"' -f 2` && "\ 25 + "cat ~/.surf/bookmarks) | awk '!seen[$0]++' > ~/.surf/bookmarks_new && "\ 26 + "mv ~/.surf/bookmarks_new ~/.surf/bookmarks", \ 27 + winid, NULL \ 28 + } \ 29 +} 30 + 31 /* styles */ 32 /* 33 * The iteration will stop at the first match, beginning at the beginning of 34 @@ -106,6 +116,7 @@ static Key keys[] = { 35 { MODKEY, GDK_space, scroll_v, { .i = +10000 } }, 36 { MODKEY, GDK_i, scroll_h, { .i = +1 } }, 37 { MODKEY, GDK_u, scroll_h, { .i = -1 } }, 38 + { MODKEY, GDK_b, spawn, BM_ADD }, 39 40 { 0, GDK_F11, fullscreen, { 0 } }, 41 { 0, GDK_Escape, stop, { 0 } },