#!/bin/sh # Open a bookmark. If the text entered is not a bookmark, search for it # using Duckduckgo, for now. [ -z "$BROWSER" ] && BROWSER="firefox" if [ -z "$ORGD_KT_PATH" ] ; then notify-send "ORGD_KT_PATH empty." "Using $HOME/docs/wr/orgd/kt as fallback." file="$HOME/docs/wr/orgd/kt/bookmark" else file="$ORGD_KT_PATH"/bookmark fi open="$(grep -v '^#\|^[ \r\n]*$' $file | \ dmenu -p 'Site to open:' -i -l 50 | \ cut -d'#' -f1 | \ sed 's/[[:space:]]*$//')" [ -z "$open" ] && exit if cat "$file" | grep -q "^.*$open.*$" ; then notify-send "Bookmark Opened" "$open has been opened." $BROWSER "$open" else notify-send "Opened DuckDuckGo" "Seached $open." $BROWSER "https://duckduckgo.com/?q=$(echo $open | tr ' ' '+')" fi