add attachment saving script which isn't perfect yet but does its job
This commit is contained in:
@@ -65,7 +65,7 @@
|
|||||||
"interval": "240"
|
"interval": "240"
|
||||||
},
|
},
|
||||||
"attachment": {
|
"attachment": {
|
||||||
"external_open_cmd": "xdg-open"
|
"external_open_cmd": "/home/max/.config/astroid/scripts/attachment-saver.sh"
|
||||||
},
|
},
|
||||||
"thread_view": {
|
"thread_view": {
|
||||||
"open_html_part_external": "false",
|
"open_html_part_external": "false",
|
||||||
|
|||||||
22
astroid/scripts/attachment-saver.sh
Executable file
22
astroid/scripts/attachment-saver.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/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
|
||||||
Reference in New Issue
Block a user