You are not logged in.

#26 2016-12-27 03:34:07

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Bash bookmarking script

You can change the number of posts per page in your profile, though.

I've seen how VBulletin handles it, selected posts are still selected when you go to the next page -- lets you move grouped posts across page boundaries. I guess FluxBB doesn't do that? sad

...

I thought there was something odd about the conversation flow.... So when are the other posts going to be moved here? wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#27 2016-12-27 03:53:51

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Bash bookmarking script

Eschwartz wrote:

So when are the other posts going to be moved here? wink


When someone who cares enough tells me what the relevant post numbers are tongue


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#28 2016-12-27 04:01:48

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Bash bookmarking script

jasonwryan wrote:
Eschwartz wrote:

So when are the other posts going to be moved here? wink


When someone who cares enough tells me what the relevant post numbers are tongue


mv /handy_commandline_utilities/${#2845-#2849} /bash_bookmarking_script/after #6

Offline

#29 2016-12-28 03:06:25

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Bash bookmarking script

thanks for moving all the posts

even *.* was failing to match "localhost:631" so added *:*
some search-words like "mpv --vo=opengl deprecated" were failing as surfraw was considering "--vo" as invalid arguement, so I have added updated keyword "ddg" to use inbuilt function inplace of surfraw's duckduckgo (onus on surfraw not my fault)
so the script is now

#!/bin/bash

### DEPENDS ON ###
    # "surfraw"-for keyword based search, you will need /usr/lib/surfraw in your path, so add below line to your .bashrc (uncommented)
    # PATH=/usr/lib/surfraw:${PATH}
### CONFIGURATION ###
    # place your browser in BROWSER=? line
    ## only if not using w3m 
	# you can use your bookmarks text file with 1 url/line, put it in second "BOOKMARKS=?" field replacing /tmp/bookmarks, comment out first "BOOKMARKS=?" line & grep -o line
    # w3m users do not need to change BOOKMARKS=?
    # default script uses rofi, to use dmenu uncomment the line starting with dmenu and comment out previous line starting with rofi
### USE ###
    # enter text in rofi/dmenu field, it will be matched against bookmarks, <enter> to open selected bookmark
    # to search specific sites use keyword as first argument ( like go for google, wi for wikipedia, aw for archwiki etc.) > read the script to find out all keywords
    # if no keyword or url is used, entire argument will be searched with duckduckgo
    # url is identified with http/www/org/com/edu/in etc., for other urls use ">" as keyword elsed it will go to duckduckgo
    # to use enterd text directly (not the matching bookmark) use <C-enter> (rofi only)
    # to edit selected bookmark use <C-space> (rofi only)

BROWSER=lariza
# only for w3m bookmarks/ comment out if not using w3m
BOOKMARKS=~/.w3m/bookmark.html
HISTORY=~/.w3m/history

# convert .w3m/bookmarks to simple text with 1 url/line; comment out if not using w3m
grep -o 'http[^"]*' $BOOKMARKS > /tmp/bookmarks
# add w3m history to the list of bookmarks
# grep -o 'http[^"]*' $HISTORY >> /tmp/bookmarks

shopt -s lastpipe
# add your plain text bookmarks here (do not edit or comment out if using w3m bookmarks)
BOOKMARKS=/tmp/bookmarks
# use rofi to display bookmarks and select one
rofi -dmenu -location 1 -l 10 -width 100 -p $BROWSER: < "$BOOKMARKS" | read -a "url"
# use dmenu inplace of roif
# /usr/bin/dmenu -l 10 -p $BROWSER: < "$BOOKMARKS" | read -a url

[[ ! $url ]] && exit

duckimage() {
x=$@
$BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=images&iax=1"
}
duckvideo() {
x=$@
$BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=videos&iax=1"
}
DDG() {
x=$@; $BROWSER "https://duckduckgo.com/?q=${x// /+}"
}

case "${url[0]}" in
    *.*|*:*|*/*)		     $BROWSER "${url[@]}" ;;
    aw|awiki)   archwiki    -browser=$BROWSER "${url[@]:1}" ;;
    wi|wiki)    wikipedia   -browser=$BROWSER "${url[@]:1}" ;;
    imdb)	imdb        -browser=$BROWSER "${url[@]:1}" ;;
    aur)	aur         -browser=$BROWSER "${url[@]:1}" ;;
    pkg)	archpkg     -browser=$BROWSER "${url[@]:1}" ;;
    ddg)	DDG			      "${url[@]:1}" ;;
    go|google)  google      -browser=$BROWSER "${url[@]:1}" ;;
    map)	google -m   -browser=$BROWSER "${url[@]:1}" ;;
#    image)	google -i   -browser=$BROWSER "${url[@]:1}" ;;   
    image) duckimage "${url[@]:1}" ;;   
#    video)	google -v   -browser=$BROWSER "${url[@]:1}" ;;   
    video) duckvideo "${url[@]:1}" ;;
    news)	google -n   -browser=$BROWSER "${url[@]:1}" ;;      
    yt|youtube)	youtube     -browser=$BROWSER "${url[@]:1}" ;;
    ebay)	ebay        -browser=$BROWSER "${url[@]:1}" ;;
    pubmed)	pubmed      -browser=$BROWSER "${url[@]:1}" ;;
    git|github)	github      -browser=$BROWSER "${url[@]:1}" ;;
    def) notify-send -t 9999999 "$( sdcv --data-dir ~/dic/english/ "${url[@]:1}" )" ;;
    *)	      duckduckgo -j -browser=$BROWSER "${url[@]}" ;;
esac

Last edited by Docbroke (2016-12-28 09:20:38)

Offline

#30 2016-12-28 05:18:00

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Bash bookmarking script

case "bl.a:h" in
    *.*|*:*) do_stuff ;;
esac

is identical to

case "bl.a:h" in
    *.*) do_stuff ;;
    *:*) do_stuff ;;
esac

Also, if you are going to be matching private domain names without any periods in them (like localhost) then that will keep failing if it uses the default port. i.e. "localhost/~user" won't get recognized as a URL even though Firefox will, appropriately, look up the */ to see if it resolves to anything.

Though you could always use 127.0.0.1 or 0.0.0.0 or 19.168.*.* instead of localhost.

Last edited by eschwartz (2016-12-28 05:28:14)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#31 2016-12-28 09:22:21

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Bash bookmarking script

added "*.*|*:*|*/*)"

Offline

#32 2017-08-09 09:36:43

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: Bash bookmarking script

@ Docbroke, is the first post updated to show the finished script? or is the latest script the last one posted?


You can like linux without becoming a fanatic!

Offline

#33 2017-08-09 10:02:16

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Bash bookmarking script

Script of post #29 was the last one updated in this thread. Latest one is below ( there aren't many changes though)

#!/bin/bash

INFO() {
    cat <<EOF>&2
### DEPENDS ON ###
     "surfraw"-for keyword based search, you will need /usr/lib/surfraw in your path, so add below line to your .bashrc (uncommented)
     PATH=/usr/lib/surfraw:${PATH}
### CONFIGURATION ###
     place your browser in BROWSER=? line
     only if not using w3m 
	# you can use your bookmarks text file with 1 url/line, put it in second "BOOKMARKS=?" field replacing /tmp/bookmarks, comment out first "BOOKMARKS=?" line & grep -o line
     w3m users do not need to change BOOKMARKS=?
     default script uses rofi, to use dmenu uncomment the line starting with dmenu and comment out previous line starting with rofi
### USE ###
     enter text in rofi/dmenu field, it will be matched against bookmarks, <enter> to open selected bookmark
     to search specific sites use keyword as first argument ( like go for google, wi for wikipedia, aw for archwiki etc.) > read the script to find out all keywords
     if no keyword or url is used, entire argument will be searched with duckduckgo
     to use enterd text directly (not the matching bookmark) use <C-enter> (rofi only)
     to edit selected bookmark use <C-space> (rofi only)
EOF
}

while getopts h: help; do
    case $help in
    h|\?) INFO && exit ;;
esac
done

shopt -s lastpipe

#echo -e "w3m\nfirefox" | rofi -dmenu -location 1 -l 10 -width 100 -font "Inconsolata 14" -p "which browser?"| read BROWSER

#[[ ! $BROWSER ]] && exit
#if [[ $BROWSER = w3m ]]; then st w3menu && exit ; fi

BROWSER=firefox
# only for w3m bookmarks/ comment out if not using w3m
# BOOKMARKS=~/.w3m/bookmark.html
BOOKMARKS=~/.config/lariza/bookmarks
#HISTORY=~/.config/lariza/history

# convert .w3m/bookmarks to simple text with 1 url/line; comment out if not using w3m
#grep -o 'http[^"]*' $BOOKMARKS > /tmp/bookmarks
cat $BOOKMARKS > /tmp/bookmarks
# add w3m history to the list of bookmarks
# grep -o 'http[^"]*' $HISTORY >> /tmp/bookmarks
#cat $HISTORY >> /tmp/bookmarks
# add your plain text bookmarks here (do not edit or comment out if using w3m bookmarks), you can add tag after the bookmark bookmart url e.g., "www.google.co.in search googlesearch", use lariza-external-handler for adding bookmarks
BOOKMARKS=/tmp/bookmarks
# use rofi to display bookmarks and select one
rofi -dmenu -location 1 -l 10 -width 100 -font "Inconsolata 14" -p $BROWSER: < "$BOOKMARKS" | read -a "url"
# use dmenu inplace of rofi
#/usr/bin/dmenu -l 10 -fn "Inconsolata 14" -p $BROWSER: < "$BOOKMARKS" | read -a url

[[ ! $url ]] && exit

duckimage() {
x=$@
$BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=images&iax=1"
}
duckvideo() {
x=$@
$BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=videos&iax=1"
}
DDG() {
x=$@; $BROWSER "https://duckduckgo.com/?q=${x// /+}"
}
MED() {
x=$@; $BROWSER "http://medical-dictionary.thefreedictionary.com/${x// /+}"
}

case "${url[0]}" in
    *.*|*:*|*/*)		     $BROWSER "${url[0]}" ;;
    aw|awiki)   archwiki    -browser=$BROWSER "${url[@]:1}" ;;
    wi|wiki)    wikipedia   -browser=$BROWSER "${url[@]:1}" ;;
    imdb)	imdb        -browser=$BROWSER "${url[@]:1}" ;;
    aur)	aur         -browser=$BROWSER "${url[@]:1}" ;;
    pkg)	archpkg     -browser=$BROWSER "${url[@]:1}" ;;
    ddg|S|DDG)	DDG			      "${url[@]:1}" ;;
    go|google)  google      -browser=$BROWSER "${url[@]:1}" ;;
    map)	google -m   -browser=$BROWSER "${url[@]:1}" ;;
#    image)	google -i   -browser=$BROWSER "${url[@]:1}" ;;   
    image) duckimage "${url[@]:1}" ;;   
#    video)	google -v   -browser=$BROWSER "${url[@]:1}" ;;   
    video) duckvideo "${url[@]:1}" ;;
    news)	google -n   -browser=$BROWSER "${url[@]:1}" ;;      
    yt|youtube)	youtube     -browser=$BROWSER "${url[@]:1}" ;;
    ebay)	ebay        -browser=$BROWSER "${url[@]:1}" ;;
    pubmed)	pubmed      -browser=$BROWSER "${url[@]:1}" ;;
    git|github)	github      -browser=$BROWSER "${url[@]:1}" ;;
    def) notify-send "$( sdcv --data-dir ~/dic/english/ "${url[@]:1}" )" && exit ;;
    guj) notify-send "$( sdcv --data-dir ~/dic/gujarati/ "${url[@]:1}" )" && exit ;;
    hin) notify-send "$( sdcv --data-dir ~/dic/hindi/ "${url[@]:1}" )" && exit ;;
    med)        MED                           "${url[@]:1}" ;;
    *)	if [[ $BROWSER != dillo ]]; then
	duckduckgo -j -browser=$BROWSER "${url[@]}"
	else
	google -browser=$BROWSER "${url[@]}"
	fi ;;
esac 

Offline

#34 2017-08-09 14:48:18

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: Bash bookmarking script

Thanks, I was just wondering why it wasnt working but I see in your latest version I had not set the path to surfraw! now its fine, lol  . Pretty neat, fast and easy to use.


You can like linux without becoming a fanatic!

Offline

#35 2017-08-10 05:21:38

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Bash bookmarking script

I am glad that you like it.
I use this another script as a companion to the bookmarking script. This second script is used in dealing with urls (in clipboard or url selected from browser), and with help of this script one can choose what to do with the url ( open with some browser, play with mpv, download or add to bookmarks etc.,). This script can be added to the context menu of firefox using "open with" extension.

#!/bin/bash

#which clipboard to use, valid options are "primary" and "clipboard"
SELECTION=clipboard
# choose bookmarks file location
BOOKMARKS="$HOME/.config/lariza/bookmarks"
#choose your terminal
TERM=termite
shopt -s lastpipe

ops=(
    w3m
    firefox
    video-play-download
    curl-download
    curl-save
    wget-saveall
    add-bookmark
	aria2
    transmission
)

getopts u: name
case $name in
u) url=$OPTARG ;;
*) url="$(xclip -o -selection $SELECTION)" ;;
#lariza "$(xclip -o -selection $SELECTION)" && exit ;;
#url="$(xclip -o -selection $SELECTION)" ;;
esac

[[ ! $url ]] && exit
# to use with rofi ##
option=$(for i in "${ops[@]}"; do echo "$i"; done |  rofi -dmenu -location 1 -l 10 -width 100 -p : -font "Inconsolata 14" -mesg "open <u>$url</u> with...")
## uncomment below line to use with dmenu , and comment out line before this ##
# option=$(for i in "${ops[@]}"; do echo "$i"; done | /usr/bin/dmenu -b )

[[ ! $option ]] && exit

case "$option" in

w3m) $TERM -e "w3m $url" ;;
video-play-download) $TERM -e "hotstar $url" ;;
## download torrent using transmission-cli
aria2) diana add "$url" ;;
transmission) transmission-remote-cli "$url" ;;
## downlod with curl in current dir (home)
curl-download) $TERM -e "curl -L -O --user-agent Mozilla/5.0 $url" ;;
## save page as curl.html in Downloads
curl-save) $TERM -e "curl -L -o ~/Downloads/curl.html --user-agent Mozilla/5.0 $url" ;;
## save full page with wget, saved in Downloads
wget-saveall) $TERM -e "wget --user-agent=Mozilla/5.0 --mirror -P $HOME/Downloads $url" ;;
# add bookmark
add-bookmark) 
	    echo -e "news\nlinux\ncycling\nsocial\nshopping\ntravel" | rofi -dmenu -location 1 -l 6 -width 100 -p : -font "Inconsolata 14" -mesg "choose tag for bookmark" | read tag
	    ## uncomment below for use with dmenu and comment out the upper line ##
	    # echo -e "news\nlinux\ncycling\nsocial\nshopping\ntravel" | /usr/bin/dmenu -fn "Inconsolata 14" -p "choose tag" | read tag
	    echo "$url $tag" >> $BOOKMARKS ;; 
## use any other external program with !chromium or !firefox or ?firefox etc.
*) $option "$url" ;;
esac 
#!/bin/bash

[[ ! $1 ]] && exit

shopt -s lastpipe

url="$1"
youtube-dl -F "$url"
echo "choose quality (from first column)"
read quality
echo choose "p) play d) download w) download in wdmc"
read -n 1 choice 
case $choice in
    p) mpv --ytdl-format="$quality" --no-resume-playback "$url" ;;
    d) youtube-dl -f "$quality" "$url" ;;
    w)  echo "KEEP THIS TERMINAL OPEN"
        ssh sharad@docstore youtube-dl -f "$quality" "$url" & ;;
esac

Offline

#36 2017-12-01 05:16:05

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Bash bookmarking script

Update to the script:
    - added routing, e.g.,"map delhi mumbai" will open google maps showing route from Delhi to Mumbai
    - this script is now optimized for vimb, luckily vimb uses text file for bookmarks with format similar to the one used in this script.
    - added dictionary (offline) function using sdcv and notify-send, will need matching data-directory in sdcv, search using "def <word>"


#!/bin/bash

INFO() {
    cat <<EOF>&2
### DEPENDS ON ###
     "surfraw"-for keyword based search, you will need /usr/lib/surfraw in your path, so add below line to your .bashrc (uncommented)
     PATH=/usr/lib/surfraw:${PATH}
### CONFIGURATION ###
     place your browser in BROWSER=? line
     place your bookmarks text file, in "BOOKMARKS=?" field, format for bookmarks is "$url $tag" per line
     default script uses rofi, to use dmenu uncomment the line starting with dmenu and comment out previous line starting with rofi
### USE ###
     enter text in rofi/dmenu field, it will be matched against bookmarks, <enter> to open selected bookmark
     to search specific sites use keyword as first argument ( like go for google, wi for wikipedia, aw for archwiki etc.) > read the script to find out all keywords
     to find out route from delhi to mumbai with google map, "map delhi mumbai", or use "map delhi" for map of delhi
     if no keyword or url is used, entire argument will be searched with duckduckgo
     to use enterd text directly (not the matching bookmark) use <C-enter> (rofi only)
     to edit selected bookmark use <C-space> (rofi only)
     To use dictionary function (keywords def/guj/hin,) you will need sdcv installed and setup, with matching data-directory
EOF
}

while getopts h: help; do
    case $help in
    h|?) INFO && exit ;;
esac
done

shopt -s lastpipe

BROWSER=vimb
BOOKMARKS=~/.config/vimb/bookmark

# use rofi to display bookmarks and select one
rofi -dmenu -location 1 -l 10 -width 100 -font "Inconsolata 14" -p $BROWSER: < "$BOOKMARKS" | read -a "url"
# use dmenu inplace of rofi
#/usr/bin/dmenu -l 10 -fn "Inconsolata 14" -p $BROWSER: < "$BOOKMARKS" | read -a url

[[ ! $url ]] && exit

duckimage() {
x=$@
$BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=images&iax=1"
}
duckvideo() {
x=$@
$BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=videos&iax=1"
}
DDG() {
x=$@; $BROWSER "https://duckduckgo.com/?q=${x// /+}"
}
MED() {
x=$@; $BROWSER "http://medical-dictionary.thefreedictionary.com/${x// /+}"
}
MAP() {
$BROWSER "https://maps.google.com/maps?saddr=$1&daddr=$2"
}
case "${url[0]}" in
    *.*|*:*|*/*)		     $BROWSER "${url[0]}" ;;
    aw|awiki)   archwiki    -browser=$BROWSER "${url[@]:1}" ;;
    wi|wiki)    wikipedia   -browser=$BROWSER "${url[@]:1}" ;;
    imdb)	imdb        -browser=$BROWSER "${url[@]:1}" ;;
    aur)	aur         -browser=$BROWSER "${url[@]:1}" ;;
    pkg)	archpkg     -browser=$BROWSER "${url[@]:1}" ;;
    ddg|S|DDG)	DDG			      "${url[@]:1}" ;;
    go|google)  google      -browser=$BROWSER "${url[@]:1}" ;;
    map)	MAP "${url[@]:1}" "${url[@]:2}" ;; 
    #google -m   -browser=$BROWSER "${url[@]:1}" ;;
#    image)	google -i   -browser=$BROWSER "${url[@]:1}" ;;   
    image) duckimage "${url[@]:1}" ;;   
#    video)	google -v   -browser=$BROWSER "${url[@]:1}" ;;   
    video) duckvideo "${url[@]:1}" ;;
    news)	google -n   -browser=$BROWSER "${url[@]:1}" ;;      
    yt|youtube)	youtube     -browser=$BROWSER "${url[@]:1}" ;;
    ebay)	ebay        -browser=$BROWSER "${url[@]:1}" ;;
    pubmed)	pubmed      -browser=$BROWSER "${url[@]:1}" ;;
    git|github)	github      -browser=$BROWSER "${url[@]:1}" ;;
    def) notify-send "$( sdcv --data-dir ~/dic/english/ "${url[@]:1}" )" && exit ;;
    guj) notify-send "$( sdcv --data-dir ~/dic/gujarati/ "${url[@]:1}" )" && exit ;;
    hin) notify-send "$( sdcv --data-dir ~/dic/hindi/ "${url[@]:1}" )" && exit ;;
    med)        MED                           "${url[@]:1}" ;;
    *)	if [[ $BROWSER != dillo ]]; then
	        duckduckgo -j -browser=$BROWSER "${url[@]}"
	    else
	        google -browser=$BROWSER "${url[@]}"
	    fi ;;
esac

Last edited by Docbroke (2017-12-01 05:35:17)

Offline

#37 2019-04-11 17:10:08

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Bash bookmarking script

One more update: added translation support with "trans", details in the script, and few minor cleanups.

#!/bin/bash

INFO() {
    cat <<EOF>&2
### DEPENDS ON ###
     "surfraw"-for keyword based search, you will need /usr/lib/surfraw in your path, so add below line to your .bashrc (uncommented)
     PATH=/usr/lib/surfraw:${PATH}
     "trans" for language translations, https://github.com/soimort/translate-shell
     "sdcv" for dictionary support
### CONFIGURATION ###
     place your browser in BROWSER=? line
	 place your bookmarks text file with 1 url/line, put it in "BOOKMARKS=?" field 
     default script uses rofi, to use dmenu uncomment the line starting with dmenu and comment out previous line starting with rofi
### USE ###
     enter text in rofi/dmenu field, it will be matched against bookmarks, <enter> to open selected bookmark
     to search specific sites use keyword as first argument ( like go for google, wi for wikipedia, aw for archwiki etc.) > read the script to find out all keywords
     to find out route from delhi to mumbai with google map, "nav delhi mumbai" or to search a location only use "map <location>"
     if no keyword or url is used, entire argument will be searched with duckduckgo
     to search with input text only (not matching bookmark) use <C-enter> (rofi only)
     to edit selected bookmark use <C-space> (rofi only)
EOF
}

while getopts h: help; do
    case $help in
    h|\?) INFO && exit ;;
esac
done

shopt -s lastpipe

## Add name of your browser here ( not text-browsers )
BROWSER=qutebrowser

## add your plain text bookmarks here, you can add tag after the bookmark bookmart url e.g., "www.google.co.in search googlesearch", use "link-handler" for adding bookmarks
BOOKMARKS=~/.config/vimb/bookmark

# use rofi to display bookmarks and select one
rofi -dmenu -location 1 -l 10 -width 100 -font "Inconsolata 14" -p $BROWSER < "$BOOKMARKS" | read -a "url"
## use dmenu inplace of rofi
#/usr/bin/dmenu -l 10 -fn "Inconsolata 14" -p $BROWSER: < "$BOOKMARKS" | read -a url

[[ ! $url ]] && exit

duckimage() {
x=$@
$BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=images&iax=1"
}
duckvideo() {
x=$@; $BROWSER "https://duckduckgo.com/?q=${x// /+}&ia=videos&iax=1"
}
DDG() {
x=$@; $BROWSER "https://duckduckgo.com/?q=${x// /+}"
}
MED() {
x=$@; $BROWSER "http://medical-dictionary.thefreedictionary.com/${x// /+}"
}
FLIPKART() {
x=$@; $BROWSER "https://www.flipkart.com/search?q=${x// /+}"
}
NAV() {
$BROWSER "https://maps.google.com/maps?saddr=$1&daddr=$2"
}

case "${url[0]}" in
    *.*|*:*|*/*)		    $BROWSER "${url[0]}" ;;
    aw|awiki)   archwiki    -browser=$BROWSER "${url[@]:1}" ;;
    wi|wiki)    wikipedia   -browser=$BROWSER "${url[@]:1}" ;;
    imdb)	    imdb        -browser=$BROWSER "${url[@]:1}" ;;
    aur)	    aur         -browser=$BROWSER "${url[@]:1}" ;;
    pkg)	    archpkg     -browser=$BROWSER "${url[@]:1}" ;;
    ddg|S|DDG)	DDG			"${url[@]:1}" ;;
    go|google)  google      -browser=$BROWSER "${url[@]:1}" ;;
    map)        google -m   -browser=$BROWSER "${url[@]:1}" ;;
    nav)	    NAV "${url[1]}" "${url[2]}" ;;
#    image)	google -i   -browser=$BROWSER "${url[@]:1}" ;;   
    image)      duckimage   "${url[@]:1}" ;;   
#    video)	google -v   -browser=$BROWSER "${url[@]:1}" ;;   
    video)      duckvideo   "${url[@]:1}" ;;
    news)	    google -n   -browser=$BROWSER "${url[@]:1}" ;;      
    yt|youtube)	youtube     -browser=$BROWSER "${url[@]:1}" ;;
    ebay)	    ebay        -browser=$BROWSER "${url[@]:1}" ;;
    fk|flipkart) FLIPKART   "${url[@]:1}" ;;
    pubmed)	    pubmed      -browser=$BROWSER "${url[@]:1}" ;;
    git|github)	github      -browser=$BROWSER "${url[@]:1}" ;;
## LOCAL DICTIONARIES
## to use def/guj/hin for dictionaries sdcv needs to setup with working dictionaries.    
    def)        notify-send "$( sdcv --data-dir ~/dic/english/ "${url[@]:1}" )" && exit ;;
    guj)        notify-send "$( sdcv --data-dir ~/dic/gujarati/ "${url[@]:1}" )" && exit ;;
    hin)        notify-send "$( sdcv --data-dir ~/dic/hindi/ "${url[@]:1}" )" && exit ;;
## ONLINE TRANSLATION
## to use translation "trans" https://github.com/soimort/translate-shell should be in path , translates to english
    trans)      notify-send "$( trans -brief "${url[@]:1}" )" && exit ;;
## translates to gujarati
    trans_gu)      notify-send "$( trans -brief :gu "${url[@]:1}" )" && exit ;;
## online medical dictionary
    med)        MED         "${url[@]:1}" ;;
    *)	if [[ $BROWSER != dillo ]]; then
	        duckduckgo -j -browser=$BROWSER "${url[@]}"
	    else
	        google -browser=$BROWSER "${url[@]}"
	    fi ;;
esac

Offline

Board footer

Powered by FluxBB