summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2017-06-21 11:49:01 +0100
committerUrbain Vaes <urbain@vaes.uk>2017-06-21 11:49:01 +0100
commitd58ce0eafa00750954fc0d807b9bdfb122b07f06 (patch)
treedb46dc2f1ce621c30790ac3d6e6ee0db9ab42b2c /bin
parent4ef38f411ec198328b5c18ba4b56b1499e4bc798 (diff)
Add script to open downloads automatically
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bin/auto-open-download13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/bin/auto-open-download b/bin/bin/auto-open-download
new file mode 100755
index 0000000..1ebeac2
--- /dev/null
+++ b/bin/bin/auto-open-download
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+inotifywait -m -q -e create $HOME/Downloads | while read line
+do
+ extension=${line##*.}
+ file=$HOME/Downloads/$(echo "$line" | cut -d " " -f 3-)
+ if [[ $extension =~ (pdf|PDF|ps|djvu) ]] ; then
+ while test $(find "$file" -mmin "-0.02"); do
+ sleep 0.02
+ done
+ zathura "$file"
+ fi
+done