Surf externalpipe patch: browsing via dmenu

Recently, I've taken the time to add a new feature to my favorite web-browser, suckless's surf. My patch is called externalpipe, and similar to the patch for st with the same name, the surf externalpipe patch allows you to arbitrarily pipe the sourcecode / raw HTML of the current page you're viewing to an external program.

Combine this with a shell script1 I made to extract all the page's links from that piped content and you get a browsing workflow that looks something like this:

Browsing some very important knowledge about dogs on boats with dmenu and surf using externalpipe patch

In effect the externalpipe patch and my script in combination enables fully keyboard-based web-browsing via dmenu in surf. Instead of clicking links on a page, you press a keybinding and bam you get a dmenu popup with all links on the page. Type any part of the link and you're taken there2.

I've been playing around with this setup for the past few weeks and for general browsing its really efficient and my urge to reach for the mouse is gone. Also I can envision the externalpipe patch enabling some other new creative uses for surf hacking3.

  1. Basically just a lot of awk and xmlint - see script the here, but pretty cool in my view that "clicking" a link is piping through awk and coreutils :)
  2. Two other patches are worth mentioning for combining externalpipe/ with to make the workflow even more efficient: (1) the surf modal patch can enable single keypress bindings (e.g. press u for example instead of C-u) and the dmenu instant patch can eliminate the need to press enter and just take you to the page once you have narrowed down the results to one item.
  3. So far, additionally I have also got find functionality with full search completion working (e.g. dmenu for search now shows / completes fragments of each word) in addition to image extraction in a dmenu list, check out my dot-files repo if interested.