pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
696 stars 164 forks source link

external viewer (with solution) #1554

Closed atrent closed 3 years ago

atrent commented 3 years ago

I would like to launch an external viewer for a message, I understand that the 'pipeto' command can be used to pipe content into another command, but most editors/viewers expect a filename parameter (instead of stdin). So I created a very simple shell script to use stdin as a file and feed it into another program.

1) in the alot config file I have:

  'ctrl r' = pipeto ~/bin/stdinGeany.sh

  'ctrl d' = pipeto --format=decoded ~/bin/stdinGeany.sh

(of course the key bindings are at your choice)

2) then in the ~/bin/ dir (where I keep my scripts) I have this (stdinGeany.sh) file:

#!/bin/bash

TMP=$(mktemp)

cat > $TMP

geany -i $TMP

You can substitute 'geany' with any editor/viewer you want, the '-i' ("new instance") option is needed to keep alot waiting for editor return, but you can remove it if you don't need to suspend alot.

(I did not find any mention of an external viewer in the doc or among the issues, feel free to RTFM me and remove this issue)

pazz commented 3 years ago

yep, that works. thanks for documenting it here. Perhaps we should link to this issue in a FAQ or so if it indeed becomes "frequently asked".

An alternative would be to write a hook that extracts the relevant part and opens, e.g. a browser.

Feel free to use the wiki to document any other such hacks that you think may be useful to others. Cheers