From e371d9edd474bcf89cf5d462eaccb8638900b390 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 3 Oct 2020 19:27:15 -0400 Subject: Initial commit --- .local/bin/websearch | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 .local/bin/websearch (limited to '.local/bin/websearch') diff --git a/.local/bin/websearch b/.local/bin/websearch new file mode 100755 index 0000000..2de2c75 --- /dev/null +++ b/.local/bin/websearch @@ -0,0 +1,31 @@ +#!/bin/sh +# Gives a dmenu prompt to search Google. +# Without input, will open Google.com. +# URLs will be directly handed to the browser. +# Anything else, it search it. + +query=$(printf " " | dmenu -i -p " Search Google") + +echo "$query" | head -c 1 + +if [ $(echo "$query" | head -c 1) == "\!" ]; then + $BROWSER "https://duckduckgo.com/?q=$query&t=ffab&atb=v1-1" +else + $BROWSER "https://google.com/?q=$query&t=ffab&atb=v1-1" +fi + + +# # pgrep -x dmenu && exit +# # pgrep -x dmenu + +# choice=$(echo "" | dmenu -i -p " Search DuckDuckGo") || exit 1 + +# if [ "$choice" = "" ]; then +# firefox "https://duckduckgo.com" +# else +# if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then +# firefox "$choice" +# else +# firefox "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" +# fi +# fi -- cgit v1.2.3