diff options
Diffstat (limited to 'etc/openfile.sh')
-rwxr-xr-x | etc/openfile.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/etc/openfile.sh b/etc/openfile.sh new file mode 100755 index 0000000..c866932 --- /dev/null +++ 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 & |