diff options
Diffstat (limited to 'bin/.local/bin/scripts/directory_navigator')
| -rwxr-xr-x | bin/.local/bin/scripts/directory_navigator | 34 |
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 |
