#!/bin/sh # Pinosaur's BookMarking or pbm # # The bookmark file should have one url on each line # Empty lines and lines with a # symbol will be ignored # # You can also add an alias for each url # Just add the alias as a second column on the same line # # example: # https://suckless.org/ ~suckless # # Requires dmenu with the 'reject no match' patch, # available at https://tools.suckless.org/dmenu/patches/reject-no-match/dmenu-rejectnomatch-4.7.diff # # this script is horrible, ill try to improve it once im better at shell scripting BOOKMARKS_FILE="$HOME/Data/bookmarks" open() { # Some error checking [ -z $BROWSER ] &&\ echo "No browser set, try setting your $BROWSER environmental variable" &&\ exit 1 selection="$(cat "$BOOKMARKS_FILE" | egrep -v '^$' | grep -v '#' \ | awk '{ print $2 }'\ | dmenu -r \ )" # Make sure that user actually selects a url [ -z "$selection" ] &&\ echo "No url selected" && exit 1 url="$(cat "$BOOKMARKS_FILE" | egrep "\s$selection" | awk '{ print $1 }')" $BROWSER "${url}" } add() { echo "Not implemented yet lolz" } [ "$1" = "-o" ] &&\ open &&\ exit 0 [ "$1" = "-a" ] &&\ add &&\ exit 0 echo "Invalid flags" && exit 1