bookmark (700B)
1 #!/bin/bash 2 3 source ~/.config/scripts/properties 4 5 shopt -s nullglob globstar 6 7 readonly BOOKMARK_FILE=~/.config/scripts/bookmarks 8 readonly SEARCH_URI="https://duckduckgo.com/?q=" 9 10 readarray -t bookmarks < "$BOOKMARK_FILE" 11 12 bookmark=$(printf '%s\n' "${bookmarks[@]}" | "$dmenu" -fn "$dmenu_font" -i -l "$dmenu_lines" "$@") 13 14 if [ -z "${bookmark}" ]; then 15 exit 1 16 fi 17 18 if [[ ! ${bookmark} =~ ^(https?://*) ]]; then 19 readonly WITH_SEARCH_ENGINE=$(printf "yes\nno" | "$dmenu" -fn "$dmenu_font" -i "$@" -p "Use search engine?") 20 if [[ "${WITH_SEARCH_ENGINE}" == yes ]]; then 21 bookmark="${SEARCH_URI}${bookmark}" 22 else 23 bookmark="https://${bookmark}" 24 fi 25 fi 26 27 xdg-open "${bookmark}" >/dev/null 2>&1 & disown