summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
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