Hi, I've been working a bit more on the patch and I think the new solution is a quite better, now everything work as spected in the popup menu: "save image as", "download linked file". And when you click a link if it cannot be displayed in surf, a xterm with wget is launched. Furthermore, this way we can remove all the AtomHiLight stuff. Also, it saves 8 LOC :)
Kind regards, -- nibble On Wed, 26 May 2010 15:33:51 +0200 "Enno Boland (Gottox)" <got...@gmail.com> wrote: > The patch looks quite good. Applied. Thanks! :) > > 2010/5/25 Nibble <nibble...@gmail.com>: > > For the moment I've done a little patch (against tip) that fixes the > > recently removed "wget download" feature, and also allows to > > download files using the "Download linked file" entry in the popup > > menu. It would be easy change the DOWNLOAD(p) macro to use another > > download manager. > > > > Kind regards, > > -- nibble > > > > On Tue, 25 May 2010 15:41:24 +0200 > > pancake <panc...@youterm.com> wrote: > > > >> On 05/25/10 15:24, Josh Rickmar wrote: > >> > On Tue, May 25, 2010 at 11:36:28AM +0200, Claudio M. Alessi > >> > wrote: > >> > > >> >> On Mon, May 24, 2010 at 04:06:00PM -0400, Josh Rickmar wrote: > >> >> > >> >>> Also, is there a better way of doing cookies then wget? As an > >> >>> (Open)BSD user, I'd like to use something in base (I did > >> >>> install wget though to test to make sure that wasn't the > >> >>> download problem above). > >> >> IIRC you can use ftp(1) for HTTP requests. > >> >> > >> > Thanks, I knew about (and use) ftp(1), but didn't think it would > >> > work with cookies. However, after checking the manpage, I see > >> > that it does support them with the -c flag. > >> > > >> > > >> Why dont distribute a shellscript that gets URL+cookie as > >> arguments, and let the users implement their own methods like > >> using wget, ftp, curl, firefox* or whatever > >> > >> * = yeah, using surf for browsing and firefox for download is the > >> most retarded idea i can think of xD.. but surely..opening xterm > >> or having a way to display all wgets in a single xterm would be > >> good (dvtm?) > >> > >> Having a suckless download manager can be good. just few locs in > >> sh. > >> > >> --pancake > >> > > > > >
diff -r 0d80b4349484 config.def.h --- a/config.def.h Wed May 26 15:34:09 2010 +0200 +++ b/config.def.h Thu May 27 12:01:35 2010 +0200 @@ -12,15 +12,13 @@ "prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | dmenu`\" &&" \ "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \ p, q, winid, NULL } } -#define DOWNLOAD(p) { \ +#define DOWNLOAD(d) { \ .v = (char *[]){ "/bin/sh", "-c", \ - "prop=\"`xprop -id $1 $0 | cut -d '\"' -f 2`\";" \ - "xterm -e \"wget --load-cookies ~/.surf/cookies.txt $prop;\"", \ - p, winid, NULL } } + "xterm -e \"wget --load-cookies ~/.surf/cookies.txt $0;\"", \ + d, NULL } } #define MODKEY GDK_CONTROL_MASK static Key keys[] = { /* modifier keyval function arg Focus */ - { MODKEY, GDK_s, spawn, DOWNLOAD("_SURF_HILIGHT") }, { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } }, { MODKEY, GDK_r, reload, { .b = FALSE } }, { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } }, diff -r 0d80b4349484 surf.c --- a/surf.c Wed May 26 15:34:09 2010 +0200 +++ b/surf.c Thu May 27 12:01:35 2010 +0200 @@ -23,7 +23,7 @@ #define LENGTH(x) (sizeof x / sizeof x[0]) #define CLEANMASK(mask) (mask & ~(GDK_MOD2_MASK)) -enum { AtomFind, AtomGo, AtomUri, AtomHiLight, AtomLast }; +enum { AtomFind, AtomGo, AtomUri, AtomLast }; typedef union Arg Arg; union Arg { @@ -188,10 +188,7 @@ gboolean decidedownload(WebKitWebView *v, WebKitWebFrame *f, WebKitNetworkRequest *r, gchar *m, WebKitWebPolicyDecision *p, Client *c) { if(!webkit_web_view_can_show_mime_type(v, m)) { - webkit_web_policy_decision_ignore(p); - webkit_web_view_load_html_string(c->view, - "Can't display content.", - webkit_network_request_get_uri(r)); + webkit_web_policy_decision_download(p); return TRUE; } return FALSE; @@ -334,7 +331,7 @@ Arg arg; updatewinid(c); - arg = (Arg)DOWNLOAD("_SURF_HILIGHT"); + arg = (Arg)DOWNLOAD((char *)webkit_download_get_uri(o)); spawn(c, &arg); return FALSE; } @@ -507,7 +504,6 @@ setatom(c, AtomFind, ""); setatom(c, AtomUri, "about:blank"); - setatom(c, AtomHiLight, "about:blank"); if(NOBACKGROUND) webkit_web_view_set_transparent(c->view, TRUE); @@ -688,7 +684,6 @@ atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False); atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False); atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False); - atoms[AtomHiLight] = XInternAtom(dpy, "_SURF_HILIGHT", False); /* dirs and files */ cookiefile = buildpath(cookiefile); @@ -763,7 +758,6 @@ t = g_strdup(c->linkhover); else t = g_strdup(c->title); - setatom(c, AtomHiLight, c->linkhover ? c->linkhover : geturi(c)); drawindicator(c); gtk_window_set_title(GTK_WINDOW(c->win), t); g_free(t);