2020-05-22 09:57:50 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Search in $BROWSER or use bookmarks from file.
|
|
|
|
|
|
|
|
bmfile="$HOME/.config/bookmarks"
|
|
|
|
|
2020-06-03 19:25:52 +02:00
|
|
|
m() {
|
|
|
|
rofi -dmenu -width 600 -i -p "Search" -l "$(wc -l "$bmfile")" \
|
|
|
|
-matching fuzzy
|
|
|
|
}
|
2020-05-22 09:57:50 +02:00
|
|
|
|
|
|
|
chosen="$(
|
|
|
|
sed 's/http.*\/ //g' "$bmfile" | m
|
|
|
|
)"
|
|
|
|
[ ! "$chosen" ] && exit 0
|
|
|
|
|
2020-05-23 15:46:44 +02:00
|
|
|
url="$(grep -m 1 "$chosen" "$bmfile" | awk '{ print $1 }')"
|
2020-05-23 20:47:32 +02:00
|
|
|
[ ! "$url" ] && {
|
|
|
|
[ "$(echo "$chosen" | grep "[a-z|0-9]\.[a-z|0-9]")" ] &&
|
2020-07-01 10:44:10 +02:00
|
|
|
url="$chosen" || url="http://searx.samedamci.me/?=&q=$chosen"
|
2020-05-23 20:47:32 +02:00
|
|
|
}
|
|
|
|
|
2020-05-22 09:57:50 +02:00
|
|
|
"$BROWSER" "$url"
|