Revert unneeded changes
This commit is contained in:
parent
6833d84077
commit
ca12ed28a5
1 changed files with 9 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue