#!/bin/sh
# ~/.local/bin/readmenu.sh

DOC_DIR="$HOME/docs/books"

choice=$(
  find "$DOC_DIR" -type f \
    \( -iname '*.pdf' -o -iname '*.epub' -o -iname '*.djvu' -o -iname '*.cbz' -o -iname '*.ps' \) \
    -printf '%f\n' | \
  bemenu -p "Read:" -l 10 -c -M 500 \
    --fn 'Monospace 14' \
    --tb '#1d2021' --tf '#d8a657' --fb '#1d2021' --ff '#d4be98' \
    --cb '#7daea3' --cf '#1d2021' --nb '#1d2021' --nf '#d4be98' \
    --hb '#7daea3' --hf '#1d2021' --sb '#7daea3' --sf '#1d2021' \
    --ab '#1b1b1b' --af '#d4be98' --scb '#1d2021' --scf '#d4be98'
)

if [ -n "$choice" ]; then
  full=$(find "$DOC_DIR" -type f -name "$choice" -print -quit)
  [ -n "$full" ] && zathura "$full"
fi

