From d58ce0eafa00750954fc0d807b9bdfb122b07f06 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 21 Jun 2017 11:49:01 +0100 Subject: Add script to open downloads automatically --- bin/bin/auto-open-download | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 bin/bin/auto-open-download 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 -- cgit v1.2.3