Tweak rofi finder script to only search for files
This commit is contained in:
parent
7fad6ba91f
commit
ab0772be9c
|
@ -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 [[ "$@" == /* ]]
|
if [[ "$@" == /* ]]; then
|
||||||
then
|
if [[ "$@" == *\?\? ]]; then
|
||||||
if [[ "$@" == *\?\? ]]
|
coproc (xdg-open "${QUERY%\/* \?\?}" >/dev/null 2>&1)
|
||||||
then
|
|
||||||
coproc ( xdg-open "${QUERY%\/* \?\?}" > /dev/null 2>&1 )
|
|
||||||
exec 1>&-
|
exec 1>&-
|
||||||
exit;
|
exit
|
||||||
else
|
else
|
||||||
coproc ( xdg-open "$@" > /dev/null 2>&1 )
|
coproc (xdg-open "$@" >/dev/null 2>&1)
|
||||||
exec 1>&-
|
exec 1>&-
|
||||||
exit;
|
exit
|
||||||
fi
|
fi
|
||||||
elif [[ "$@" == \!\!* ]]
|
elif [[ "$@" == \!\!* ]]; then
|
||||||
then
|
echo "Type your search query to find files"
|
||||||
echo "!!-- Type your search query to find files"
|
elif [[ "$@" == \?* ]]; then
|
||||||
echo "!!-- To search again type !<search_query>"
|
|
||||||
echo "!!-- To search parent directories type ?<search_query>"
|
|
||||||
echo "!!-- You can print this help by typing !!"
|
|
||||||
elif [[ "$@" == \?* ]]
|
|
||||||
then
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
echo "$line" \?\?
|
echo "$line" \?\?
|
||||||
done <<< $(fd "${QUERY#\?}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error')
|
done <<<$(fd -t file "${QUERY#\?}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error')
|
||||||
else
|
else
|
||||||
fd "${QUERY#!}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error'
|
fd -t file "${QUERY#!}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error'
|
||||||
fi
|
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
|
||||||
|
|
Loading…
Reference in New Issue