|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#Создан: Чт 23 июн 2016 13:14:17
|
|
|
|
#Изменён: Пн 15 ноя 2021 10:31:16
|
|
|
|
|
|
|
|
# BROWSER=surf,vimprobable2,vimb,jumanji,chromium
|
|
|
|
BROWSER=firefox-bin
|
|
|
|
|
|
|
|
SEARCH="https://duckduckgo.com/?q="
|
|
|
|
|
|
|
|
#title:url
|
|
|
|
#?XXX? title:url
|
|
|
|
URLS="$SHELLRC/var/www/urls"
|
|
|
|
|
|
|
|
LINES=7
|
|
|
|
|
|
|
|
# URL="$(rofi -dmenu -hide-scrollbar -columns 8 -location 1 -width 100 -lines 10 -input $URLS)"
|
|
|
|
|
|
|
|
TITLES="$(awk '/\[/{print NR-1}' "$URLS" | paste -s -d ',')"
|
|
|
|
|
|
|
|
BADURLS="$(awk '/XXX/{print NR-1}' "$URLS" | paste -s -d ',')"
|
|
|
|
|
|
|
|
WEBSITE=$(cat "$URLS" \
|
|
|
|
| cut -d ':' -f 1 \
|
|
|
|
| sed 's/XXX //' \
|
|
|
|
| rofi -dmenu -hide-scrollbar -i -columns 3 -location 1 -width 100 -lines $LINES -a "$TITLES" -u "$BADURLS" -p "web:")
|
|
|
|
|
|
|
|
if [ -n "$WEBSITE" ]; then
|
|
|
|
URL="$(grep "${WEBSITE}:" "$URLS" | cut -d ':' -f 2-)"
|
|
|
|
|
|
|
|
if [ -n "$URL" ]; then
|
|
|
|
$BROWSER "$URL"
|
|
|
|
else
|
|
|
|
case $WEBSITE in
|
|
|
|
/*) "$BROWSER" "${WEBSITE/\/}" ;;
|
|
|
|
*) "$BROWSER" "$(tr ' ' '+' <<<"${SEARCH}${WEBSITE}")";;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|