aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/mutt-open
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-03-28 16:48:20 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-03-28 16:50:46 +0300
commitc9ec0cb4bd6a550dcf076095fee48531a4f68fd7 (patch)
tree5d39d6746e7945123c92a83a6653cb925fb54d16 /dotfiles/.local/bin/mutt-open
parent92eb6448ad4cad8b22584dceb34b4e4696f36953 (diff)
downloadswayrice-c9ec0cb4bd6a550dcf076095fee48531a4f68fd7.tar.gz
swayrice-c9ec0cb4bd6a550dcf076095fee48531a4f68fd7.zip
neomutt config
Well, it seems that I am back to using neomutt. Aerc still can't figure pgp out.
Diffstat (limited to 'dotfiles/.local/bin/mutt-open')
-rwxr-xr-xdotfiles/.local/bin/mutt-open10
1 files changed, 10 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/mutt-open b/dotfiles/.local/bin/mutt-open
new file mode 100755
index 0000000..e8adbb9
--- /dev/null
+++ b/dotfiles/.local/bin/mutt-open
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Helps open a file with xdg-open from mutt in a external program without weird side effects.
+tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mail/files"
+file="$tempdir/$(basename "$1")"
+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