diff options
author | tsxv478 <vt0451@yandex.ru> | 2022-09-25 03:23:37 +0300 |
---|---|---|
committer | tsxv478 <vt0451@yandex.ru> | 2022-09-25 03:23:37 +0300 |
commit | a84257e10aa3ca1b616424e2e4532bc785428756 (patch) | |
tree | 7c9d85c93cafcbb6c2de3675b62de9783fb33ff5 | |
parent | 8938c8c1cbd37d8b6684c073e5eccf4129ce0e55 (diff) |
bookmark script
-rwxr-xr-x | bm | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 |