dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c8b507d03f9247447663661706118ade89d75bb0
parent 02daff51ecd664badda6d6688e13186700b99bcb
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Wed, 19 Dec 2018 07:50:43 -0500

Merge pull request #160 from anders-dc/ducksearch

Detect http urls in ducksearch and directly connect to them
Diffstat:
M.scripts/i3cmds/ducksearch | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/.scripts/i3cmds/ducksearch b/.scripts/i3cmds/ducksearch @@ -2,14 +2,21 @@ # 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 "Search DuckDuckGo:") || exit 1 if [ "$choice" = "🦆" ]; then - $BROWSER "https://duckduckgo.com" + $browser "https://duckduckgo.com" else - $BROWSER "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" + # Detect if url + if [[ "$choice" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$ ]]; then + $browser "$choice" + else + $browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" + fi fi