Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.9 KiB

  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. +/* BM_ADD(readprop) */
  21. +#define BM_ADD(r) {\
  22. + .v = (const char *[]){ "/bin/sh", "-c", \
  23. + "(echo $(xprop -id $0 $1) | cut -d '\"' -f2 " \
  24. + "| sed 's/.*https*:\\/\\/\\(www\\.\\)\\?//' && cat ~/.surf/bookmarks) " \
  25. + "| awk '!seen[$0]++' > ~/.surf/bookmarks.tmp && " \
  26. + "mv ~/.surf/bookmarks.tmp ~/.surf/bookmarks", \
  27. + winid, r, NULL \
  28. + } \
  29. +}
  30. +
  31. /* styles */
  32. /*
  33. * The iteration will stop at the first match, beginning at the beginning of
  34. @@ -132,6 +144,7 @@ static Key keys[] = {
  35. { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
  36. { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
  37. { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
  38. + { MODKEY, GDK_KEY_m, spawn, BM_ADD("_SURF_URI") },
  39. { 0, GDK_KEY_Escape, stop, { 0 } },
  40. { MODKEY, GDK_KEY_c, stop, { 0 } },