dotfiles/scripts/menu/menu-addbookmark
2023-08-03 18:22:46 -06:00

15 lines
401 B
Bash
Executable file

#!/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"
else
name="$(menu 'Bookmark name:' empty)"
[ -z "$name" ] && exit
entry="$name-$bookmark"
echo "$entry" >> "$HOME/Documents/bookmarks"
notify-send "󰃀 Bookmarks" "Added '$entry'"
fi