summaryrefslogtreecommitdiff
path: root/bm
blob: b538f89a5ae9dbfe0a0969c5539cb22a9bef5efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

path="$HOME/.local/share/bookmarks.txt"
bookmark=$(cat $path | dmenu -i -c -bw 3 -l 15 -p "Bookmark:")

[ -z $bookmark ] && exit
# append a url to the list if it's not present and exit
[ -z $(grep -F $bookmark $path) ] && printf "%s\n" "$bookmark" >> $path && exit

action=$(printf "Open in browser\nCopy to clipboard\n" | dmenu -i -c -bw 3 -l 2 -p "Action:")

case $action in
	"Open in browser") $BROWSER $bookmark ;;
	"Copy to clipboard") printf "%s" "$bookmark" | xclip -selection clipboard ;;
	*) exit ;;
esac