aboutsummaryrefslogtreecommitdiff
path: root/bin/.local/bin/scripts/directory_navigator
diff options
context:
space:
mode:
Diffstat (limited to 'bin/.local/bin/scripts/directory_navigator')
-rwxr-xr-xbin/.local/bin/scripts/directory_navigator34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/.local/bin/scripts/directory_navigator b/bin/.local/bin/scripts/directory_navigator
new file mode 100755
index 0000000..2bf01e4
--- /dev/null
+++ b/bin/.local/bin/scripts/directory_navigator
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Navigate directories with fzf and open a program based on file extension
+
+# Function to navigate directories with fzf
+navigate_directories() {
+ selected_file=$(find "$HOME" -type f | fzf --height=50%)
+ if [ -n "$selected_file" ]; then
+ file_extension="${selected_file##*.}"
+
+ case "$file_extension" in
+ "pdf")
+ zathura "$selected_file"
+ ;;
+ ".org")
+ emacsclient -c "$selected_file"
+ ;;
+ ".png" | ".webp" | ".gif" | ".jpg")
+ nsxiv "$selected_file"
+ ;;
+ *)
+ # Example: open other file types with a default program
+ xdg-open "$selected_file"
+ ;;
+ esac
+ fi
+}
+
+# Main script
+main() {
+ navigate_directories
+}
+
+main