summaryrefslogtreecommitdiff
path: root/scripts/websearch
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-16 00:48:34 +0100
committerdavidovski <david@davidovski.xyz>2022-05-16 00:48:34 +0100
commit381aaffe4ed3caa0f1356b720f6d4fc0de5b1f8f (patch)
treedc8a619c66a8e538f94ac2701b6e42750d0d9406 /scripts/websearch
parent1406e81f40a5e0ef4632e7c518b0629514a79de3 (diff)
removed bash and added mkshrc
Diffstat (limited to 'scripts/websearch')
-rwxr-xr-xscripts/websearch17
1 files changed, 10 insertions, 7 deletions
diff --git a/scripts/websearch b/scripts/websearch
index 996ddc3..32d8773 100755
--- a/scripts/websearch
+++ b/scripts/websearch
@@ -1,14 +1,17 @@
#!/bin/sh
-
-SEARCH_ENGINE="https://search.brave.com/search?q="
-SEARCH_HISTORY=/tmp/.search_history
+browser="links-launcher"
+SEARCH_ENGINE="https://librex.beparanoid.de/search.php?q="
+SEARCH_HISTORY=$HOME/.local/share/search_history
SEARCH=$(cat $SEARCH_HISTORY | dmenu -p "search")
-touch $SEARCH_HISTORY
+echo "$SEARCH" >> $SEARCH_HISTORY
-cat <<< "$SEARCH
-$(cat $SEARCH_HISTORY)" > $SEARCH_HISTORY
+query=$(echo $SEARCH | sed 's/ /+/g')
-brave "$SEARCH_ENGINE$SEARCH"
+echo $query | grep -q '(?=^.{5,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)' && {
+ links-launcher "$query"
+} || {
+ links-launcher "$SEARCH_ENGINE$query"
+}