summaryrefslogtreecommitdiff
path: root/bm
diff options
context:
space:
mode:
authortsxv478 <atci39@rambler.ru>2023-04-21 01:00:44 +0300
committertsxv478 <atci39@rambler.ru>2023-04-21 01:00:44 +0300
commit1bd89daea4e7e29ebadf8926f35db39d636402a9 (patch)
treec37ee8bf09892f2e85b072c52e23c51c8a19c6a3 /bm
parentf8bc625f60aae6643034a77ba2cb85bd4b4cfe31 (diff)
fix bm
Diffstat (limited to 'bm')
-rwxr-xr-xbm14
1 files changed, 7 insertions, 7 deletions
diff --git a/bm b/bm
index baffdfe..8a79c2e 100755
--- a/bm
+++ b/bm
@@ -1,17 +1,17 @@
#!/bin/sh
-dir="$HOME/.local/share/bookmarks.txt"
-bookmark=$(tac $dir | dmenu -i -c -l 15 -p "Bookmark:")
+bmfile="$HOME/.local/share/bookmarks.txt"
+url=$(tac "$bmfile" | dmenu -i -c -l 15 -p "URL:")
-[ -z $bookmark ] && exit
+[ -z "$url" ] && exit
# append a url to the list if it's not present and exit
-[ -z $(grep -F $bookmark $dir) ] && printf "%s\n" "$bookmark" >> $dir && exit
+grep -Fq "$url" "$bmfile" || { printf "%s\n" "$url" >> "$bmfile" ; exit ; }
action=$(printf "Open in browser\nCopy to clipboard" | dmenu -i -c -l 2 -p "Action:")
-case $action in
- "Open in browser") $BROWSER $bookmark ;;
- "Copy to clipboard") printf "%s" "$bookmark" | xclip -selection clipboard &&
+case "$action" in
+ "Open in browser") $BROWSER "$url" ;;
+ "Copy to clipboard") printf "%s" "$url" | xclip -selection clipboard &&
notify-send "URL copied to clipboard" ;;
*) exit ;;
esac