dots/.bin/fzf-book

14 lines
582 B
Bash
Executable File

#!/usr/bin/env bash
# Find and open pdf
# Generate menu of book filenames and save paths
# Preview window contains metadata
# selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1 --preview 'pdfinfo {}' --preview-window=right:70%:wrap)"
selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1)"
echo "Opening \"$selected\""
# Open when a file is selected and redirect output to /dev/null
[[ -n "$selected" ]] && zathura "$selected" --fork &> /dev/null