aboutsummaryrefslogtreecommitdiff
path: root/scripts/.scripts/books.sh
diff options
context:
space:
mode:
authoromagdy <omar.professional8777@gmail.com>2025-07-22 21:40:14 +0300
committeromagdy <omar.professional8777@gmail.com>2025-07-22 21:40:14 +0300
commit6e861bc3b7596fac769a5bf3b3506770cbc0338c (patch)
treeaee42c480ea54055075d203dd6e98f50fba9bc82 /scripts/.scripts/books.sh
parent14d2af5be5d3c7c7d04345399feed63480a0d1cf (diff)
downloaddotfiles-6e861bc3b7596fac769a5bf3b3506770cbc0338c.tar.xz
dotfiles-6e861bc3b7596fac769a5bf3b3506770cbc0338c.zip
scripts: Edited some scripts to check for escape to close selector menu
Diffstat (limited to 'scripts/.scripts/books.sh')
-rwxr-xr-xscripts/.scripts/books.sh16
1 files changed, 8 insertions, 8 deletions
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"