On Fri, 9 Oct 2009 10:37:39 +0200 Yoshi Rokuko <yoshi.rok...@yokuts.org> wrote:
> On Wed, Oct 07, 2009 at 10:51:38PM +0200, Julien Steinhauser wrote: > > > > On surf, ctrl-y, echo -e `sselp | dmenu` >> $file bound to a key > > binding, and you can tag it as you like, retrieving is just as so > > easy, just load the grepped file in a vertical dmenu, fresch patch > > for dmenu on archlinux forum has multiselect feature so one can > > load several url in one dmenu go. > > > > On a surf launched with the -x option, the two steps required to add > > a tagged bookmark to a list are reduced to one step. > > If one wish to add the window title to the bookmark, > > just pasting such a string somewhere in the bookmarking script does > > the trick xprop -id `cat ~/.surf/id` | grep WM_ICON_NAME\(STRING\) > > | cut -c 24- > > > > i try to minimize my key bindings that's why i use a bmark script > (evoked by dmenu again) like that: > > switch(`{echo -e search\nload\nstore | dmenu}){ > case store > xprop _SURF_URL | sed 's/.*= "//;s/"//' >> /home/hiro/bmarks > case load > xprop -f _SURF_URL 8t -set _SURF_URL `{cat /home/hiro/bmarks | > dmenu_vrtc -l 20} case search > query=`{echo | dmenu} > xprop -f _SURF_URL 8t -set _SURF_URL > 'http://www.google.de/search?q='^$"query } > > i don't use the xid because i dont know how to do it, how do you guys > do it? how do you start surf (script?), do you have only one surf > instance? what do i miss here? > > regards, yOshi > Here's my custom config.h and and my surf-script.sh. The config.h is for hg tip, but the spawn function works in 0.1.2 as well. Just copy/paste as required. surf-script.sh should be placed at $HOME/.surf/surf-script.sh. There should also be a file at $HOME/.surf/stack with a list of urls. The spawn function calls surf-script.sh with a configurable first argument (look at the keybindings), the xid as the second argument, and the url as the third. surf-script.sh is just a fancy case statement that acts according to the first argument. surf-script.sh can also be called with no arguments for a new browser instance. I use it bound to a key in dwm to launch surf. The script also interprets "g foo bar" to be a google search for "foo bar". Regards, josh
/* modifier 0 means no modifier */ static gchar *progress = "dodgerblue2"; static gchar *progress_trust = "#00FF00"; static void spawn(Client *c, const Arg *arg); #define MODKEY GDK_CONTROL_MASK static Key keys[] = { /* modifier keyval function arg Focus */ { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE }, Any }, { MODKEY, GDK_r, reload, { .b = FALSE }, Any }, { MODKEY|GDK_SHIFT_MASK,GDK_g, showurl, { 0 }, Any }, { MODKEY, GDK_slash, showsearch, { 0 }, Any }, { 0, GDK_Escape, hidesearch, { 0 }, Any }, { 0, GDK_Escape, hideurl, { 0 }, Any }, { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 }, Any }, { MODKEY, GDK_p, clipboard, { .b = TRUE }, Browser }, { MODKEY, GDK_y, clipboard, { .b = FALSE }, Browser }, { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 }, Browser }, { MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 }, Browser }, { MODKEY|GDK_SHIFT_MASK,GDK_i, zoom, { .i = 0 }, Browser }, { MODKEY, GDK_l, navigate, { .i = +1 }, Browser }, { MODKEY, GDK_h, navigate, { .i = -1 }, Browser }, { MODKEY, GDK_j, scroll, { .i = +1 }, Browser }, { MODKEY, GDK_k, scroll, { .i = -1 }, Browser }, { 0, GDK_Escape, stop, { 0 }, Browser }, { MODKEY, GDK_o, source, { 0 }, Browser }, { MODKEY, GDK_n, searchtext, { .b = TRUE }, Browser|SearchBar }, { MODKEY|GDK_SHIFT_MASK,GDK_n, searchtext, { .b = FALSE }, Browser|SearchBar }, { 0, GDK_Return, searchtext, { .b = TRUE }, SearchBar }, { GDK_SHIFT_MASK, GDK_Return, searchtext, { .b = FALSE }, SearchBar }, { 0, GDK_Return, loaduri, { .v = NULL }, UrlBar }, { 0, GDK_Return, hideurl, { 0 }, UrlBar }, { MODKEY, GDK_g, spawn, { .v = "go" }, Any }, { MODKEY, GDK_b, spawn, { .v = "add" }, Any }, }; void spawn(Client *c, const Arg *arg) { const gchar *filename; const gchar *scriptname; scriptname = "surf-script.sh"; filename = g_build_filename(workdir, scriptname, NULL); const gchar *command = (gchar *)arg->v; const gchar *xid = g_strdup_printf("%u", (guint)GDK_WINDOW_XID(GTK_WIDGET(c->win)->window)); gdk_display_sync(gtk_widget_get_display(c->win)); if (fork() ==0) execlp(filename, scriptname, command, xid, webkit_web_view_get_uri(c->view), NULL); }
surf-script.sh
Description: application/shellscript