From a84257e10aa3ca1b616424e2e4532bc785428756 Mon Sep 17 00:00:00 2001 From: tsxv478 Date: Sun, 25 Sep 2022 03:23:37 +0300 Subject: bookmark script --- bm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bm diff --git a/bm b/bm new file mode 100755 index 0000000..b538f89 --- /dev/null +++ b/bm @@ -0,0 +1,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 -- cgit v1.2.3