On 08/25/2011 03:40 PM, Nick wrote:
I think it would be really neat to be able to send all the
text in a terminal to an external program, to act on it as
it likes.

I wrote a patch to do that, sending the contents of the
screen to the stdin of the chosen program.

One good use for this is writing a script to find any links,
and offer to open them in a browser using dmenu. A
particularly crude version of this could be:

#!/bin/sh
sed -e '/http/!d' -e 's/.*http/http/g' -e 's/ .*//g' | dmenu | xargs surf

There are a couple of things which need fixing / could do
with some discussion:

1) At present I commented out the SIGCHLD handler, as it was
blocking the process from returning. I confess to not being
overly familiar with the finer points of forking, so hope
someone better than me can suggest a fix.

2) This could be a feature that people would find useful to
trigger several different scripts. At present the key
binding is hardcoded (meta-|); should we add something to
be able to better define keybindings in config.h?
Wouldn't it be more suckless (or unix way?) to let a terminal multiplexer (who said tmux?) do that ?
Espicially when it already do it.

I use this in my tmux.conf for opening links (I think it's from arch wiki):
bind o capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -k -n urls -t:0 'cat /tmp/tmux-buffer | urlview'

tuxg

Reply via email to