diff -up surf-2.0/config.def.h surf-2.0-history/config.def.h --- surf-2.0/config.def.h 2017-11-26 14:29:37.963786915 +0100 +++ surf-2.0-history/config.def.h 2017-11-26 19:48:31.300096237 +0100 @@ -6,6 +6,7 @@ static char *styledir = "~/.surf/s static char *certdir = "~/.surf/certificates/"; static char *cachedir = "~/.surf/cache/"; static char *cookiefile = "~/.surf/cookies.txt"; +static char *historyfile = "~/.surf/history.txt"; /* Webkit default features */ /* Highest priority value will be used. @@ -101,6 +102,11 @@ static WebKitFindOptions findopts = WEBK } \ } +#define SETURI(p) { .v = (char *[]){ "/bin/sh", "-c", \ +"prop=\"`surf_history_dmenu.sh`\" &&" \ +"xprop -id $1 -f $0 8s -set $0 \"$prop\"", \ +p, winid, NULL } } + /* styles */ /* * The iteration will stop at the first match, beginning at the beginning of @@ -181,6 +187,7 @@ static Key keys[] = { { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, + { MODKEY , GDK_KEY_Return, spawn, SETURI("_SURF_GO") }, }; /* button definitions */ Only in surf-2.0-history/: config.h Only in surf-2.0: .git Only in surf-2.0-history/: surf diff -up surf-2.0/surf.c surf-2.0-history/surf.c --- surf-2.0/surf.c 2017-11-26 14:29:37.963786915 +0100 +++ surf-2.0-history/surf.c 2017-11-26 14:20:36.757100476 +0100 @@ -171,6 +171,7 @@ static void newwindow(Client *c, const A static void spawn(Client *c, const Arg *a); static void destroyclient(Client *c); static void cleanup(void); +static void updatehistory(const char *u, const char *t); /* GTK/WebKit */ static WebKitWebView *newview(Client *c, WebKitWebView *rv); @@ -336,10 +337,11 @@ setup(void) curconfig = defconfig; /* dirs and files */ - cookiefile = buildfile(cookiefile); - scriptfile = buildfile(scriptfile); - cachedir = buildpath(cachedir); - certdir = buildpath(certdir); + cookiefile = buildfile(cookiefile); + historyfile = buildfile(historyfile); + scriptfile = buildfile(scriptfile); + cachedir = buildpath(cachedir); + certdir = buildpath(certdir); gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy)); @@ -1042,12 +1044,28 @@ cleanup(void) while (clients) destroyclient(clients); g_free(cookiefile); + g_free(historyfile); g_free(scriptfile); g_free(stylefile); g_free(cachedir); XCloseDisplay(dpy); } +void +updatehistory(const char *u, const char *t) +{ + FILE *f; + f = fopen(historyfile, "a+"); + + char b[20]; + time_t now = time (0); + strftime (b, 20, "%Y-%m-%d %H:%M:%S", localtime (&now)); + fputs(b, f); + + fprintf(f, " %s %s\n", u, t); + fclose(f); +} + WebKitWebView * newview(Client *c, WebKitWebView *rv) { @@ -1417,6 +1435,7 @@ loadfailedtls(WebKitWebView *v, gchar *u return TRUE; } + void loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c) { @@ -1445,6 +1464,7 @@ loadchanged(WebKitWebView *v, WebKitLoad break; case WEBKIT_LOAD_FINISHED: seturiparameters(c, uri, loadfinished); + updatehistory(uri, c->title); /* Disabled until we write some WebKitWebExtension for * manipulating the DOM directly. evalscript(c, "document.documentElement.style.overflow = '%s'", Only in surf-2.0-history/: surf.o