index.md (1733B)
1 externalpipe 2 ============ 3 4 Description 5 ----------- 6 7 Pipe the current page's source to an external program. This is particularly 8 helpful for keyboard-based link following and also for viewing the source in an 9 external editor. Works both when javascript is enabled and disabled. 10 11 Example 12 ------- 13 Install the below shell scripts into your `$PATH`: 14 * [surf_linkselect.sh](surf_linkselect.sh) - extracts links via xmllint and 15 pipes to dmenu, converts selected link to valid URL. 16 * [edit_screen.sh](edit_screen.sh) - open source in `$EDITOR` for copying text. 17 18 19 Add to your `config.h`: 20 static char *linkselect_curwin [] = { "/bin/sh", "-c", 21 "surf_linkselect.sh $0 'Link' | xargs -r xprop -id $0 -f _SURF_GO 8s -set _SURF_GO", 22 winid, NULL 23 }; 24 static char *linkselect_newwin [] = { "/bin/sh", "-c", 25 "surf_linkselect.sh $0 'Link (new window)' | xargs -r surf", 26 winid, NULL 27 }; 28 static char *editscreen[] = { "/bin/sh", "-c", "edit_screen.sh", NULL }; 29 ... 30 static Key keys[] = { 31 { MODKEY, GDK_KEY_d, externalpipe, { .v = linkselect_curwin } }, 32 { GDK_SHIFT_MASK|MODKEY, GDK_KEY_d, externalpipe, { .v = linkselect_newwin } }, 33 { MODKEY, GDK_KEY_o, externalpipe, { .v = editscreen } }, 34 ... 35 } 36 37 Now you have the new keybindings: 38 - **Ctrl-d** - open dmenu with links, select to follow in current surf window 39 - **Ctrl-Shift-d** - open dmenu with links, select to open in new surf window 40 - **Ctrl-o** - view sourcecode for the current page in your editor 41 42 43 Download 44 -------- 45 46 * [surf-2.0-externalpipe.diff](surf-2.0-externalpipe.diff) (2379) (20190807) 47 48 Author 49 ------ 50 51 * Miles Alan - m@milesalan.com 52 * Rob Pilling - robpilling@gmail.com (author of st externalpipe, which pipe code is based on)