This repository has been archived on 2023-01-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mail-config/astroid/scripts/attachment-saver.sh

23 lines
551 B
Bash
Raw Normal View History

#!/bin/bash
#
# based on https://github.com/astroidmail/astroid/issues/339#issuecomment-300491869
cachedir=~/.cache/astroid-attachments
attachment=$(echo $1 | sed "s#.*astroid/##")
touch $cachedir/token.$attachment
if [ ! -e ${cachedir} ]; then
mkdir -p ${cachedir}
fi
mv $1 ~/.cache/astroid-attachments/
inotifywait -e close "$1" &
ip=$!
# open file (you can replace this with xdg-open)
xdg-open "$cachedir/$attachment"
while inotifywait -r -e close $cachedir/$attachment; do rm $cachedir/token.$attachment || rm $cachedir/$attachment; done