91861 / wayst

A simple terminal emulator
MIT License
283 stars 8 forks source link

Feature request: pipe terminal contents to external program #65

Closed etenim closed 3 years ago

etenim commented 3 years ago

You could pipe to a script that searches for text and displays the results in a launcher like wofi, letting you easily select between many matches.

As an example:

--pipe /usr/local/bin/some-wofi-script # Command to pipe to (default: "")
--bind-key-pipe Ctrl+Shift+backslash
91861 commented 3 years ago

Added by 798b0936465eba14bf7d51b2313764908876aa7a.

Maybe we could also pass some useful info to the script as command line parameters?

etenim commented 3 years ago

Added by 798b093.

Awesome! I can confirm it works on my end. I got the last url with this:

#!/bin/sh
ugrep -io "(http|https)://[a-z.\-/0-9a]*" < /dev/stdin | tail -n1 | wl-copy

Maybe we could also pass some useful info to the script as command line parameters?

Yes, good idea. Could be things like window title, application ID and the like. Maybe some info about the content being piped.

There's a lot of potential uses for this feature overall.

etenim commented 3 years ago

I've noticed that the last line of output in a wayst terminal doesn't get piped to the external program. At least not until another new line is output.

An example: cat the contents of a file, the last line of the file is not in the pipe data sent to the external program. Then simply pressing "enter" at the PS1 prompt will cause the final line of the file to be piped as well.

Using this in my config: extern-pipe = command:screen

etenim commented 3 years ago

Thank you for fixing the extern-pipe bug.

etenim commented 3 years ago

I think this can be closed, and rather re-opened later if something comes up.