From 226d87c2b40c98e9413ef1be5b4384fc14c521c4 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Tue, 7 Jul 2020 18:48:41 +0200 Subject: [PATCH] configured search enginge prompt to use own server --- .local/bin/tools/searx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 .local/bin/tools/searx diff --git a/.local/bin/tools/searx b/.local/bin/tools/searx new file mode 100755 index 0000000..1292c42 --- /dev/null +++ b/.local/bin/tools/searx @@ -0,0 +1,21 @@ +#!/bin/sh +# Gives a dmenu prompt to search DuckDuckGo. +# Without input, will open DuckDuckGo.com. +# URLs will be directly handed to the browser. +# Anything else, it search it. +browser=${BROWSER:-firefox} + +pgrep -x dmenu && exit + +choice=$(echo "🦆" | dmenu -i -p "Searx:") || exit 1 + +if [ "$choice" = "🦆" ]; then + $browser "https://searx.bocken.org" +else + if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then + $browser "$choice" + else + string="$(echo $choice | sed 's/\ /+/g')" + $browser "https://searx.bocken.org/?q=$string&t=ffab&atb=v1-1" + fi +fi