dmenu local book library

Here's a little script, that uses dmenu to open books store on your computer and keeps track of visited books. It's probably slow and ugly, but it works for me ☻.



books=$(find $HOME/books/)

# create a history file if doesn't exsit yet
touch $books_history

# awk is used to print unique paths without breaking the initial order
target=$(echo "$books" | awk '!x[$0]++' $books_history - \
	     | dmenu -l 20 -i -p book:)

if [[ -n $target ]]; then
    echo "$target" | awk '!x[$0]++' - $books_history > $tmp_history
    mv $tmp_history $books_history
    zathura "$target"

Created: 2021-12-06 Пн 18:37