I will answer my own question. The following entry in .muttrc
does what I want:
macro attach O \
"\
<enter-command>unset wait_key<enter>\
<shell-escape>rm -f /tmp/mutt-attach<enter>\
<save-entry><kill-line>/tmp/mutt-attach<enter>\
<shell-escape> /tmp/mutt-attach &^A\
"
Description (line by line):
- map the macro to the
O
key in attachment mode - disable "Press any key to continue ..."
- remove the file
/tmp/mutt-attach
if it exists - save the selected entry to
/tmp/mutt-attach
- start a shell command, input
/tmp/mutt-attach &
and go to the beginning of the line (^A
)
Then I can simply input the program I want to use and hit enter, which will open the selected attachment in the background.