[bibtex] Fix rofi-bib-due display options

Fixed displaying urgent and non-urgent items. Fixed passing along of
date filters and other options. Fixed using correct library pdf
directory (still hardcoded to pdf subdirectory of $BIBFILE).
This commit is contained in:
Marty Oehme 2020-05-12 21:42:01 +02:00
parent 5ceb05bbce
commit c0d88e338a
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A

View file

@ -3,13 +3,11 @@
exist rofi normal
_rofi() {
rofi -dmenu -no-auto-select -i "$@" -theme themes/dropdown -p "papers" -l 25 -yoffset 20
rofi -dmenu -no-auto-select -i -theme themes/dropdown -p "papers" -l 25 -yoffset 20 -columns 1 -u "$urgent"
}
bib=${1:-$BIBFILE}
# call for whatever file is passed in
results="$(bib-due "$1")"
results="$(bib-due "$@")"
# mark priority 1 items as urgent in rofi
urgent="$(
@ -19,13 +17,13 @@ urgent="$(
)"
# get user choice, exit if nothing selected
choice=$(echo "$results" | _rofi -u "$urgent" -columns 1)
choice=$(echo "$results" | _rofi)
[ -z "$choice" ] && exit 0
key=$(echo "$choice" | sed -E 's/.*\((\w+)\)$/\1/')
# get library pdf folder (only searches for default ./pdf path)
library="$(dirname "$(realpath "$bib")")/pdf"
library="$(dirname "$(realpath "$BIBFILE")")/pdf"
# find and open the key-associated pdf file
${FILEREADER:-xdg-open} "$(find "$library" -type f -name "$key *.pdf")"