mutt-wizard

fork of Luke Smiths mutt-wizard
git clone git://git.jakekoroman.com/mutt-wizard
Log | Files | Refs | README | LICENSE

commit 26c0df4511461c2062784531458b6b84ea73e6b0
parent f0abb7190ab74155a344f31812330ca2aa9a855a
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Tue,  6 Nov 2018 15:08:23 -0500

more general openfile script

Diffstat:
Detc/htmlopen.sh | 11-----------
Metc/mailcap | 4++--
Aetc/openfile.sh | 14++++++++++++++
3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/etc/htmlopen.sh b/etc/htmlopen.sh @@ -1,11 +0,0 @@ -#!/bin/sh - -# Helps open an HTML file from mutt in a GUI browser without weird side effects. - -file=$(mktemp -u --suffix=.html) - -rm -f "$file" - -cp "$1" "$file" - -setsid firefox "$file" >/dev/null 2>&1 & diff --git a/etc/mailcap b/etc/mailcap @@ -1,7 +1,7 @@ text/plain; vim %s ; -text/html; ~/.config/mutt/etc/htmlopen.sh %s ; +text/html; ~/.config/mutt/etc/openfile.sh %s ; text/html; w3m -I %{charset} -T text/html; copiousoutput; image/*; ~/.config/mutt/etc/muttimage.sh %s ; copiousoutput video/*; setsid mpv --quiet %s &; copiousoutput -application/pdf; cp '%s' /tmp/doc.pdf && setsid zathura /tmp/doc.pdf &; copiousoutput; +application/pdf; ~/.config/mutt/etc/openfile.sh %s ; application/pgp-encrypted; gpg -d '%s'; copiousoutput; diff --git a/etc/openfile.sh b/etc/openfile.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Helps open a file with xdg-open from mutt in a external program without weird side effects. + +base=$(basename "$1") +ext="${base##*.}" + +file=$(mktemp -u --suffix=".$ext") + +rm -f "$file" + +cp "$1" "$file" + +setsid xdg-open "$file" >/dev/null 2>&1 &