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.

107 lines
3.3 KiB

  1. diff -up surf-2.0/config.def.h surf-2.0-history/config.def.h
  2. --- surf-2.0/config.def.h 2017-11-26 14:29:37.963786915 +0100
  3. +++ surf-2.0-history/config.def.h 2017-11-26 19:48:31.300096237 +0100
  4. @@ -6,6 +6,7 @@ static char *styledir = "~/.surf/s
  5. static char *certdir = "~/.surf/certificates/";
  6. static char *cachedir = "~/.surf/cache/";
  7. static char *cookiefile = "~/.surf/cookies.txt";
  8. +static char *historyfile = "~/.surf/history.txt";
  9. /* Webkit default features */
  10. /* Highest priority value will be used.
  11. @@ -101,6 +102,11 @@ static WebKitFindOptions findopts = WEBK
  12. } \
  13. }
  14. +#define SETURI(p) { .v = (char *[]){ "/bin/sh", "-c", \
  15. +"prop=\"`surf_history_dmenu.sh`\" &&" \
  16. +"xprop -id $1 -f $0 8s -set $0 \"$prop\"", \
  17. +p, winid, NULL } }
  18. +
  19. /* styles */
  20. /*
  21. * The iteration will stop at the first match, beginning at the beginning of
  22. @@ -181,6 +187,7 @@ static Key keys[] = {
  23. { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
  24. { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
  25. { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
  26. + { MODKEY , GDK_KEY_Return, spawn, SETURI("_SURF_GO") },
  27. };
  28. /* button definitions */
  29. Only in surf-2.0-history/: config.h
  30. Only in surf-2.0: .git
  31. Only in surf-2.0-history/: surf
  32. diff -up surf-2.0/surf.c surf-2.0-history/surf.c
  33. --- surf-2.0/surf.c 2017-11-26 14:29:37.963786915 +0100
  34. +++ surf-2.0-history/surf.c 2017-11-26 14:20:36.757100476 +0100
  35. @@ -171,6 +171,7 @@ static void newwindow(Client *c, const A
  36. static void spawn(Client *c, const Arg *a);
  37. static void destroyclient(Client *c);
  38. static void cleanup(void);
  39. +static void updatehistory(const char *u, const char *t);
  40. /* GTK/WebKit */
  41. static WebKitWebView *newview(Client *c, WebKitWebView *rv);
  42. @@ -336,10 +337,11 @@ setup(void)
  43. curconfig = defconfig;
  44. /* dirs and files */
  45. - cookiefile = buildfile(cookiefile);
  46. - scriptfile = buildfile(scriptfile);
  47. - cachedir = buildpath(cachedir);
  48. - certdir = buildpath(certdir);
  49. + cookiefile = buildfile(cookiefile);
  50. + historyfile = buildfile(historyfile);
  51. + scriptfile = buildfile(scriptfile);
  52. + cachedir = buildpath(cachedir);
  53. + certdir = buildpath(certdir);
  54. gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
  55. @@ -1042,12 +1044,28 @@ cleanup(void)
  56. while (clients)
  57. destroyclient(clients);
  58. g_free(cookiefile);
  59. + g_free(historyfile);
  60. g_free(scriptfile);
  61. g_free(stylefile);
  62. g_free(cachedir);
  63. XCloseDisplay(dpy);
  64. }
  65. +void
  66. +updatehistory(const char *u, const char *t)
  67. +{
  68. + FILE *f;
  69. + f = fopen(historyfile, "a+");
  70. +
  71. + char b[20];
  72. + time_t now = time (0);
  73. + strftime (b, 20, "%Y-%m-%d %H:%M:%S", localtime (&now));
  74. + fputs(b, f);
  75. +
  76. + fprintf(f, " %s %s\n", u, t);
  77. + fclose(f);
  78. +}
  79. +
  80. WebKitWebView *
  81. newview(Client *c, WebKitWebView *rv)
  82. {
  83. @@ -1417,6 +1435,7 @@ loadfailedtls(WebKitWebView *v, gchar *u
  84. return TRUE;
  85. }
  86. +
  87. void
  88. loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c)
  89. {
  90. @@ -1445,6 +1464,7 @@ loadchanged(WebKitWebView *v, WebKitLoad
  91. break;
  92. case WEBKIT_LOAD_FINISHED:
  93. seturiparameters(c, uri, loadfinished);
  94. + updatehistory(uri, c->title);
  95. /* Disabled until we write some WebKitWebExtension for
  96. * manipulating the DOM directly.
  97. evalscript(c, "document.documentElement.style.overflow = '%s'",
  98. Only in surf-2.0-history/: surf.o