commit 88c626fc4a01cd1bf2a5438d3951db77aa457851 parent d339561e84808c92d103907665b6404ea5f698d7 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 2 May 2019 16:43:52 +0200 Include bookmarks in regular search Diffstat:
M | bin/ducksearch | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/bin/ducksearch b/bin/ducksearch @@ -6,14 +6,21 @@ # Anything else, it search it. browser=${BROWSER:-firefox} -choice=$(echo "" | dmenu_themed -i -p "Search DuckDuckGo:") || exit 1 +url="🦆 +$(grep 'href="htt' "$HOME"/.w3m/bookmark.html | \ + sed 's/<\/.*>//g' | \ + sed 's/.*<a href="//;s/">/ /;s/<\/a>//' ; + cat ~/doc/bookmark.txt)" +choice=$(echo "$url" | dmenu_themed -i -p "Search DuckDuckGo:") || exit 1 + +echo "$choice" if [ "$choice" = "🦆" ]; then $browser "https://duckduckgo.com" else # Detect if url if [[ "$choice" =~ ^(http:\/\/|https:\/\/)?[a-zA-Z0-9\-]+\.[a-zA-Z]+(/)?.*$ ]]; then - $browser "$choice" + $browser "$(echo "$choice" | awk '{print $1}')" else case "$choice" in scholar*)