THEAARBS menus - search

Published 05-06-2018 03:11:46

#!/bin/sh
# Easy web searching

SearchSites="DuckDuckGo\nArchWiki\nBandCamp\nIMDB\nReddit\nRev\nWikipedia\nYouTube"

SearchCommands() {
    case "$Choice" in
        r|Reddit)   $runprefix rtv -s "$Query" ;;
        yt|YouTube) $runprefix youtube-viewer $Query ;;
        rev|Rev)    $BROWSER "https://revolutiontt.me/browse.php?search=$Query" ;;
        ddg|DuckDuckGo) $BROWSER "https://duckduckgo.com/?q=$Query&t=ffab&atb=v1-1" ;;
        aw|ArchWiki)    $BROWSER "https://wiki.archlinux.org/index.php?search=$Query" ;;
        w|Wikipedia)    $BROWSER "https://en.wikipedia.org/?search=$Query" ;;
        bc|BandCamp)    $BROWSER "https://bandcamp.com/search?q=$Query" ;;
        im|IMDB)    $BROWSER "http://www.imdb.com/find?ref_=nv_sr_fn&q=$Query&s=all" ;;
    esac ;}

. ~/.cache/wal/colors.sh
runprefix=
mymenu="fzf --prompt="Service""
Query=${@:2}
Choice=$1
amitty=$(tty)
case $amitty in
    *tty1|"not a tty")    mymenu="dmenu -i -nb $color0 -nf $color7 -sb $color1 -sf $color7 -l 12 -b -p "Service""
                runprefix="$TERMINAL -e" ;;
esac
if [ -z "$Choice" ]; then Choice=$(echo -e $SearchSites | sort -n | $mymenu) || exit ; fi
if [ -z "$Query"  ]; then Query=$(inprompt "Terms") || exit ; fi
if [ -z "$Query"  ]; then exit ; fi
if [ -z "$Choice" ]; then Choice="ddg" ; fi

SearchCommands