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 f998963a0bb1653b274fee0dd77ee4ead2f1c94d
parent ee93d4dd9351f512a81a06821c74c3ddcb7c43d5
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 25 Nov 2019 11:39:21 +0100

Allow web searches from linkhandler and add OSM integration

Diffstat:
M.local/bin/ducksearch | 22+++++++++++++++-------
M.local/bin/linkhandler | 8++++++--
2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/.local/bin/ducksearch b/.local/bin/ducksearch @@ -6,12 +6,17 @@ # Anything else, it search it. browser=${BROWSER:-firefox} -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 +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 +else + choice="$@" +fi if [ "$choice" = "🦆" ]; then $browser "https://duckduckgo.com" @@ -21,8 +26,11 @@ else $browser "$(echo "$choice" | awk '{print $1}')" else case "$choice" in - scholar\ *) - $browser "https://scholar.google.com/scholar?q=${choice/scholar /}" + *!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" diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler @@ -34,7 +34,7 @@ handle_url() { notify-send "linkhandler" "comic" action="comic" ;; *) - action="$(printf "open\nopen (tbb)\nxclip\nbookmark\ndownload\nhtml to pdf\nsci-hub\nadd bibref\nmpv\nxdg-open\nyoutube-dl\nyoutube-dl-music" | \ + action="$(printf "open\nopen (tbb)\nxclip\nducksearch\nmap\nbookmark\ndownload\nhtml to pdf\nsci-hub\nscholarref\nmpv\nxdg-open\nyoutube-dl\nyoutube-dl-music" | \ dmenu -i -p "$(echo "$url" | sed 's/.*:\/\///' | cut -c-80)")";; esac @@ -64,10 +64,14 @@ handle_url() { out="$HOME/tmp/html_to_pdf_$(date +'%F-%T')".pdf && \ wkhtmltopdf "$url" "$out" && \ notify-send "$(basename $out) complete" ;; + "ducksearch") + ducksearch "$url";; + "map") + ducksearch "!map $url";; "sci-hub") echo "shdl --tor-socks --notify --open --reference '$url' >/dev/null" \ | at now;; - "add bibref") + "scholarref") echo "getdoi '$url' | getref --notify >> '$BIB'" | at now;; "mpv") nohup mpv -quiet "$url" >/dev/null 2>&1 & ;;