Revert unneeded changes

This commit is contained in:
Anders Damsgaard 2018-12-19 10:28:09 +01:00
parent 6833d84077
commit ca12ed28a5

View file

@ -1,18 +1,22 @@
#!/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
query=$(echo "duckduckgo.com" | dmenu -i -p "Search DuckDuckGo:") || exit 1
choice=$(echo "🦆" | dmenu -i -p "Search DuckDuckGo:") || exit 1
if [ "$query" = "duckduckgo.com" ]; then
if [ "$choice" = "🦆" ]; then
$browser "https://duckduckgo.com"
else
# Detect if url
if [[ "$query" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+.[a-zA-Z]+(/)?.*$ ]]; then
$browser "$query"
if [[ "$choice" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+.[a-zA-Z]+(/)?.*$ ]]; then
$browser "$choice"
else
$browser "https://duckduckgo.com/?q=$query&t=ffab&atb=v1-1"
$browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1"
fi
fi