From 6e861bc3b7596fac769a5bf3b3506770cbc0338c Mon Sep 17 00:00:00 2001 From: omagdy Date: Tue, 22 Jul 2025 21:40:14 +0300 Subject: scripts: Edited some scripts to check for escape to close selector menu --- scripts/.scripts/books.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'scripts/.scripts/books.sh') diff --git a/scripts/.scripts/books.sh b/scripts/.scripts/books.sh index 71232e0..5f43410 100755 --- a/scripts/.scripts/books.sh +++ b/scripts/.scripts/books.sh @@ -12,22 +12,22 @@ path="/mnt/Storage/omar/Books/" if [ "$XDG_SESSION_TYPE" = "wayland" ]; then - launcher="rofi -dmenu -i -l 10" + launcher=(rofi -dmenu -i -l 10 -p "Book name" -theme-str "window { width: 45%; }") elif [ "$XDG_SESSION_TYPE" = "x11" ]; then - launcher="dmenu -i -l 10" + launcher=(dmenu -i -l 10) else echo "Error: Could not detect display server (Wayland or X11)." exit 1 fi -# Direct approach - no temp file, just pipe everything -choice=$(fd -e pdf . "$path" -x basename | sort | $launcher) +# Pipe filenames to launcher and capture choice +choice=$(fd -e pdf . "$path" -x basename | sort | "${launcher[@]}") -if [ -z "$choice" ]; then - exit 0 -fi +# Exit silently if nothing selected +[ -z "$choice" ] && exit 0 -# Find the file again (less efficient but simpler) +# Find the full path of the selected file full_path=$(fd -e pdf . "$path" | grep "/$choice$" | head -1) +# Open in zathura fullscreen zathura --mode fullscreen "$full_path" -- cgit v1.2.3