All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
5 if [ -z "$TMPDIR" ]; then
7 elif [ -d "${TMPDIR}/volatile" ]; then
8 TMPDIR="${TMPDIR}/volatile"
11 TMPDIR=$(mktemp -dp "$TMPDIR" mutt.XXXXXXXXXX)
12 cleanup() { cd / && rm -rf "$TMPDIR"; }
13 trap cleanup 1 2 3 4 5 6 7 8 10 11 12 13 14 15
18 if [ -x "$(command -v awesome-client)" ]; then
19 awesome-client <<-_eof
20 local naughty = require("naughty")
21 naughty.notify({ preset = naughty.config.presets.low,
24 $(sed -e 's,\",\\\",g' "$1")
26 $(sed -e 's,\",\\\",g' "$2")]]
33 python -c "import mimetypes; print(mimetypes.guess_extension('$1'))"
37 run-mailcap --action=view "$1":"$2" > output.stdout 2> output.stderr
45 t=$(tempfile -d . -p mutt -s $(guess_extension "$MIMETYPE"))
49 t="$(echo ${1##*/} | sed -re 's![^[:alnum:],.@%^+=_-]!_!gi')"
56 if [ -s "$TMPDIR/output.stdout" ] || [ -s "$TMPDIR/output.stderr" ]; then
57 notify $TMPDIR/output.stdout $TMPDIR/output.stderr \
58 "Output from mutt/$SELF on $BASENAME"
64 # make a copy of the file, then launch a shell process in the background
65 # to divert to run-mailcap, after which the temporary directory gets
67 FILE="$(get_file "${1:-}")"
69 launch_viewer "$MIMETYPE" "$FILE"
74 trap - 1 2 3 4 5 6 7 8 10 11 12 13 14 15
77 # hack to stay around until the viewer has read the file: make a fifo and
78 # wait for the cat process to finish writing to it, which means that it
79 # must have been consumed on the other end.
80 FILE="$(get_file "${1:-}")"
81 FIFO="${FILE%/*}/fifo-${FILE##*/}"
83 cat "$FILE" > "$FIFO" &
84 # For some reason, we do have to write a tempfile and cannot seem to
85 # redirect stdin directly to the fifo, i.e. this does not work instead of
86 # the previous three lines:
88 launch_viewer "$MIMETYPE" "${FIFO}"