#!/bin/sh
# Get URL from clipboard
# and save as a bookmark

bookmark="$(xsel -ob)"

if grep -q "$bookmark" "$HOME/Documents/bookmarks" ; then
    notify-send "󰃀 Bookmarks" "Already bookmarked"
    exit
else
    name="$(menu "Bookmark name:" empty)"
    [ -z "$name" ] && exit
    entry="$name-$bookmark"
    echo "$entry" >> "$HOME/Documents/bookmarks"
    notify-send "󰃀 Bookmarks" "Added '$entry'"
fi