diff options
Diffstat (limited to 'bin/dmscripts/dmpdf')
-rwxr-xr-x | bin/dmscripts/dmpdf | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/dmscripts/dmpdf b/bin/dmscripts/dmpdf new file mode 100755 index 0000000..6137e1a --- /dev/null +++ b/bin/dmscripts/dmpdf @@ -0,0 +1,21 @@ +#!/bin/bash +directory="${1:-$PWD}" +choice="$(\ + find "${directory}" \ + -type f \ + -iname "*.pdf" \ + -printf "%p\n" \ + | awk -F '/' '{print $(NF - 1) "/" $NF}' \ + | sort \ + | uniq \ + | dmenu -i -x -p "pdf:" -l 10 -g 2 \ + | awk -F '/' '{print $2}' \ +)" + +# find matching file +file="$(\ + find "$directory" -name "*$choice*" \ +)" + +[[ -f "$file" ]] || exit 1 +evince "$file" & |