Compare commits

...

1 Commits

Author SHA1 Message Date
ab0772be9c
Tweak rofi finder script to only search for files 2020-10-01 16:08:18 +02:00

View File

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