diff --git a/rofi/.local/share/rofi/finder.sh b/rofi/.local/share/rofi/finder.sh index 8f9875b..0e261ca 100755 --- a/rofi/.local/share/rofi/finder.sh +++ b/rofi/.local/share/rofi/finder.sh @@ -2,38 +2,27 @@ #PUT THIS FILE IN ~/.local/share/rofi/finder.sh #USE: rofi -show find -modi find:~/.local/share/rofi/finder.sh -if [ ! -z "$@" ] -then - QUERY=$@ - if [[ "$@" == /* ]] - then - if [[ "$@" == *\?\? ]] - then - coproc ( xdg-open "${QUERY%\/* \?\?}" > /dev/null 2>&1 ) - exec 1>&- - exit; - else - coproc ( xdg-open "$@" > /dev/null 2>&1 ) - exec 1>&- - exit; - fi - elif [[ "$@" == \!\!* ]] - then - echo "!!-- Type your search query to find files" - echo "!!-- To search again type !" - echo "!!-- To search parent directories type ?" - echo "!!-- You can print this help by typing !!" - elif [[ "$@" == \?* ]] - then - while read -r line; do - echo "$line" \?\? - done <<< $(fd "${QUERY#\?}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error') - else - fd "${QUERY#!}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error' - fi +if [ ! -z "$@" ]; then + QUERY=$@ + if [[ "$@" == /* ]]; then + if [[ "$@" == *\?\? ]]; then + coproc (xdg-open "${QUERY%\/* \?\?}" >/dev/null 2>&1) + exec 1>&- + exit + else + coproc (xdg-open "$@" >/dev/null 2>&1) + exec 1>&- + exit + fi + elif [[ "$@" == \!\!* ]]; then + echo "Type your search query to find files" + elif [[ "$@" == \?* ]]; then + while read -r line; do + echo "$line" \?\? + done <<<$(fd -t file "${QUERY#\?}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error') + else + fd -t file "${QUERY#!}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error' + fi else - echo "!!-- Type your search query to find files" - echo "!!-- To seach again type !" - echo "!!-- To seach parent directories type ?" - echo "!!-- You can print this help by typing !!" + echo "Type your search query to find files" fi