22 lines
473 B
Bash
Executable File
22 lines
473 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Search in $BROWSER or use bookmarks from file.
|
|
|
|
bmfile="$HOME/.config/bookmarks"
|
|
|
|
m() { rofi -dmenu -width 600 -i -p "Search" -l "$(wc -l "$bmfile")" ;}
|
|
|
|
chosen="$(
|
|
sed 's/http.*\/ //g' "$bmfile" | m
|
|
)"
|
|
[ ! "$chosen" ] && exit 0
|
|
|
|
url="$(grep -m 1 "$chosen" "$bmfile" | awk '{ print $1 }')"
|
|
[ ! "$url" ] && {
|
|
[ "$(echo "$chosen" | grep "[a-z|0-9]\.[a-z|0-9]")" ] &&
|
|
url="https://$chosen" || url="https://duckduckgo.com/?q=$chosen"
|
|
}
|
|
|
|
|
|
"$BROWSER" "$url"
|