summaryrefslogtreecommitdiffstats
path: root/mutt-open
diff options
context:
space:
mode:
Diffstat (limited to 'mutt-open')
-rwxr-xr-xmutt-open13
1 files changed, 13 insertions, 0 deletions
diff --git a/mutt-open b/mutt-open
new file mode 100755
index 0000000..00dbca1
--- /dev/null
+++ b/mutt-open
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# simple wrapper that copies the file recieved by mutt to a temporary directory and open it in the background
+
+set -euo pipefail
+
+command=$1
+file=$2
+
+tmpdir=$(mktemp -d 'mutt-open.XXXXXXXXX')
+filename="${1##*/}"
+cp "$file" "$tmpdir/$filename"
+systemd-cat "$command" "$tmpdir/$filename"