aboutsummaryrefslogtreecommitdiff
path: root/scripts/.scripts
diff options
context:
space:
mode:
authoromagdy <omar.professional8777@gmail.com>2025-07-17 19:14:35 +0300
committeromagdy <omar.professional8777@gmail.com>2025-07-17 19:14:35 +0300
commit52d21d68621c9d3dd2a8a6d4bb50acca31e99ee4 (patch)
tree6407a7cb6c7d41765cb1f246fdcbef111d9e4871 /scripts/.scripts
parent694639e8772a44cef65ffc7de87efe29c0dea95c (diff)
downloaddotfiles-52d21d68621c9d3dd2a8a6d4bb50acca31e99ee4.tar.xz
dotfiles-52d21d68621c9d3dd2a8a6d4bb50acca31e99ee4.zip
Modified books script to just search for file name instead of navigating a file tree
Diffstat (limited to 'scripts/.scripts')
-rwxr-xr-xscripts/.scripts/books.sh26
-rwxr-xr-xscripts/.scripts/screenshot_screen.sh3
2 files changed, 12 insertions, 17 deletions
diff --git a/scripts/.scripts/books.sh b/scripts/.scripts/books.sh
index 6c49d62..71232e0 100755
--- a/scripts/.scripts/books.sh
+++ b/scripts/.scripts/books.sh
@@ -9,33 +9,25 @@
# #
##################################################################
-# Set the path to the books directory
path="/mnt/Storage/omar/Books/"
-# Detect whether we're in a Wayland or X11 session
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
- # Wayland session - use wofi
- launcher="wofi --dmenu -i -l 10"
+ launcher="rofi -dmenu -i -l 10"
elif [ "$XDG_SESSION_TYPE" = "x11" ]; then
- # X11 session - use dmenu
launcher="dmenu -i -l 10"
else
echo "Error: Could not detect display server (Wayland or X11)."
exit 1
fi
-# Initial directory to choose from
-choice=$(ls -a "$path" | $launcher)
+# Direct approach - no temp file, just pipe everything
+choice=$(fd -e pdf . "$path" -x basename | sort | $launcher)
-# Initialize the new choice as the first directory selected
-new_choice=$choice
+if [ -z "$choice" ]; then
+ exit 0
+fi
-# Loop through directories until a file is selected
-while [ -d "$path/$new_choice" ]; do
- # Recurse into the selected directory and show options again
- choice=$(ls -a "$path/$new_choice" | $launcher)
- new_choice+="/$choice" # Append the choice to the path
-done
+# Find the file again (less efficient but simpler)
+full_path=$(fd -e pdf . "$path" | grep "/$choice$" | head -1)
-# Open the selected file with zathura in fullscreen mode
-zathura --mode fullscreen "$path/$new_choice"
+zathura --mode fullscreen "$full_path"
diff --git a/scripts/.scripts/screenshot_screen.sh b/scripts/.scripts/screenshot_screen.sh
new file mode 100755
index 0000000..41b634a
--- /dev/null
+++ b/scripts/.scripts/screenshot_screen.sh
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+
+flameshot screen --clipboard