Various Linux scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
965 B

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