25 lines
510 B
Bash
Executable File
25 lines
510 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Generate menu of book filenames and save paths
|
|
# Preview window contains metadata
|
|
|
|
function select_file {
|
|
echo "$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1)"
|
|
}
|
|
|
|
function open {
|
|
if [ -n "$1" ]; then
|
|
echo "Opening \"$1\""
|
|
zathura "$1" --fork
|
|
else
|
|
echo "No file selected"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
--open) open "$(select_file)" ;;
|
|
--help) printf "open \n" >&2 ;;
|
|
*) open "$(select_file)" ;;
|
|
esac
|