dots/.bin/fzf-book

12 lines
561 B
Bash
Executable File

#!/usr/bin/env bash
# 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