only show clipboard option if clipboard is non-empty

modified:   .local/bin/tools/searx
This commit is contained in:
Alexander Bocken 2020-09-05 16:21:14 +02:00
parent 3de15502ea
commit ccc2d1ef6d

View File

@ -5,12 +5,16 @@
# Anything else, it search it.
browser=${BROWSER:-firefox}
choice=$(printf "🔍\n📋\n" | dmenu -i -p "Searx:") || exit 1
if [ -z "$(xclip -o -selection clipboard)" ]; then
choice=$(printf "🔍\n" | dmenu -i -p "Searx:") || exit 1
else
choice=$(printf "🔍\n📋\n" | dmenu -i -p "Searx:") || exit 1
fi
if [ "$choice" = "🔍" ]; then
$browser "https://searx.bocken.org"
elif [ "$choice" = "📋" ]; then
$browser "$(xclip -o --clipboard=clipboard)"
$browser "$(xclip -o -selection clipboard)"
else
if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
$browser "$choice"