Skip to content

Commit

Permalink
more general openfile script
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeSmithxyz committed Nov 6, 2018
1 parent f0abb71 commit 26c0df4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
11 changes: 0 additions & 11 deletions etc/htmlopen.sh

This file was deleted.

4 changes: 2 additions & 2 deletions 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;
14 changes: 14 additions & 0 deletions 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 &

0 comments on commit 26c0df4

Please sign in to comment.