dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit b2569a58db8aef5dc6ec5188afa71a110bd61db7
parent 733c2ab93d1c02e1161992538c8ad966ef472f37
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sun,  5 Jan 2020 20:36:47 +0100

Update duckduckgo settings

Diffstat:
M.local/bin/ducksearch | 38++++++++++++++------------------------
1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/.local/bin/ducksearch b/.local/bin/ducksearch @@ -1,40 +1,30 @@ #!/usr/bin/env bash -# 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} - - if [ $# -lt 1 ]; then url="$(grep 'href="htt' "$HOME"/code/adamsgaard.dk/output/bookmark.html | \ sed 's/<\/.*>//g' | \ sed 's/.*<a href="//;s/">/ /;s/<\/a>//' ; cat ~/doc/bookmark.txt)" - choice=$(echo "$url" | dmenu -i -p "Search DuckDuckGo:") || exit 1 + choice=$(echo "$url" | dmenu -i -p "search:") || exit 1 else choice="$@" fi -if [ "$choice" = "🦆" ]; then - $browser "https://duckduckgo.com" +# Detect if url +if [[ "$choice" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9\-]+\.[a-zA-Z]+(/)?.*$ ]]; then + $BROWSER "$(echo "$choice" | awk '{print $1}')" else - # Detect if url - if [[ "$choice" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9\-]+\.[a-zA-Z]+(/)?.*$ ]]; then - $browser "$(echo "$choice" | awk '{print $1}')" - else - case "$choice" in - *!scholar*) - $browser "https://scholar.google.com/scholar?q=${choice/!scholar/}" - ;; - *!map*) - $browser "https://www.openstreetmap.org/search?query=${choice/!map/}" - ;; - *) - $browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1" - ;; + case "$choice" in + *!scholar*) + $BROWSER "https://scholar.google.com/scholar?q=${choice/!scholar/}" + ;; + *!map*) + $BROWSER "https://www.openstreetmap.org/search?query=${choice/!map/}" + ;; + *) + $BROWSER "https://duckduckgo.com/?q=$choice&kae=d&kau=-1&kao=-1&kap=-1&kaq=-1&kax=-1&kak=-1&kv=-1&kk=-1&k1=-1&kc=-1" + ;; esac fi fi