diff options
Diffstat (limited to 'dotfiles/.local/bin')
-rwxr-xr-x | dotfiles/.local/bin/mutt-open | 10 |
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 |