#!/usr/bin/env bash BOOKS="/ar1/Books" file_name="$(find "$BOOKS" -type f -printf "%f\n" | sed 's/\.[^.]*$//' | rofi -dmenu -i -p "Books:" -theme ~/.config/rofi/menu.rasi)" if [ ! -z "$file_name" ]; then file_path="$(find "$BOOKS" -type f -name "$file_name.*")" extension="${file_path#*.}" if [ "$extension" == "epub" ]; then ebook-viewer --detach "$file_path" >/dev/null 2>&1 else xdg-open "$file_path" >/dev/null 2>&1 fi fi