diff -r a5c3c1ebe5c7 config.def.h --- a/config.def.h Mon Oct 26 22:02:21 2009 +0100 +++ b/config.def.h Mon Oct 26 15:48:03 2009 -0700 @@ -42,4 +42,5 @@ { "Stop", stop, { 0 } }, { "Paste URI", clipboard, { .b = TRUE } }, { "Copy URI", clipboard, { .b = FALSE } }, + { "Download", preinitdl, { 0 } }, }; diff -r a5c3c1ebe5c7 surf.c --- a/surf.c Mon Oct 26 22:02:21 2009 +0100 +++ b/surf.c Mon Oct 26 15:48:03 2009 -0700 @@ -94,6 +94,7 @@ static WebKitWebView *createwindow(WebKitWebView *v, WebKitWebFrame *f, Client *c); static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event, gpointer d); +static void preinitdl(Client *c, const Arg *arg); static void print(Client *c, const Arg *arg); static void progresschange(WebKitWebView *v, gint p, Client *c); static void reloadcookies(); @@ -314,6 +315,18 @@ return buf; } +void +preinitdl(Client *c, const Arg *arg) { + WebKitNetworkRequest *wnr; + WebKitDownload *wdl; + + if (c->linkhover) { + wnr = webkit_network_request_new(c->linkhover); + wdl = webkit_download_new(wnr); + initdownload(c->view, wdl, c); + } +} + gboolean initdownload(WebKitWebView *view, WebKitDownload *o, Client *c) { const char *filename;