#!/bin/bash

_BASENAME=$(basename "$0")
_DIRNAME="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
cd "$_DIRNAME" || _exit 1

_URL=$(grep -Ev "^#" ./bookmarks | rofi -dmenu -i -p Bookmarks)

if [[ "$_URL" == "edit" ]]
then
  urxvt -e nvim /usr/local/share/dotfiles/scripts/bookmarks
  exit 0
fi


if [[ -n $_URL ]]
then
  firefox "$(awk '{print $1}' <<< "$_URL")"
fi
