summaryrefslogtreecommitdiff
path: root/etc/openfile.sh
blob: c86693220250736d2a6fd57b4e2ff53de8fec899 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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 &