aboutsummaryrefslogtreecommitdiff
path: root/neomutt/openfile
diff options
context:
space:
mode:
authorBlaster4385 <venkatesh@tablaster.dev>2024-12-01 00:08:36 +0530
committerBlaster4385 <venkatesh@tablaster.dev>2024-12-01 00:08:36 +0530
commit354496635ea960960d43dfeab8eee9d8341edd89 (patch)
tree6e47f334d0ac45002235cdeffe0c363a42c4cebd /neomutt/openfile
parent1f825cbc5e545f1e3df14af2b7b0d244e930c764 (diff)
feat: added neomutt config
Diffstat (limited to 'neomutt/openfile')
-rw-r--r--neomutt/openfile9
1 files changed, 9 insertions, 0 deletions
diff --git a/neomutt/openfile b/neomutt/openfile
new file mode 100644
index 0000000..7b229b0
--- /dev/null
+++ b/neomutt/openfile
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/neomutt/files"
+file="$tempdir/${1##*/}"
+[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open"
+mkdir -p "$tempdir"
+cp -f "$1" "$file"
+$opener "$file" >/dev/null 2>&1
+find "${tempdir:?}" -mtime +1 -type f -delete