Compare commits
3 Commits
87b1a43888
...
98f03e2f55
| Author | SHA1 | Date | |
|---|---|---|---|
| 98f03e2f55 | |||
| 86003ac69f | |||
| 4434fb533c |
@ -93,3 +93,4 @@ to open, copy and add bookmarks via dmenu/rofi.
|
||||
- [ ] Enhance `edit` arguments. Should take similar arguments as `open`.
|
||||
- [ ] Allow reading the bookmark file via stdin and writing it out via stdout.
|
||||
This would allow someone to easily encrypt their bookmarks if they wish.
|
||||
- [ ] Add notification on adding bookmark via dmenu
|
||||
|
||||
@ -15,6 +15,5 @@ To list matching tags: `sxbm_dmenu +tag`
|
||||
* `-y` or `--yank` will copy the selected link to your clipboard
|
||||
(requires `xclip`) instead of opening them. Example: `sxbm_dmenu -y title`
|
||||
|
||||
* `-a` or `--add` is an alias to `sxbm add`.
|
||||
Example: `sxbm_dmenu -a link.com +tag`
|
||||
|
||||
* `-a` or `--add` pipes user input to `sxbm add`.
|
||||
Example: `sxbm_dmenu -a`
|
||||
|
||||
@ -5,14 +5,13 @@
|
||||
# Author: NRK
|
||||
## Copyright 2021 NRK
|
||||
## Licensed under GPL v3. See LICENSE for more details.
|
||||
|
||||
# Change "dmenu" to "rofi -dmenu" if you wish to use rofi
|
||||
# NOTE: i do not use rofi, and haven't tested if it works or not
|
||||
prompt="dmenu -i -l 24"
|
||||
|
||||
bm_open() {
|
||||
link_num="$(sxbm ls -c "$@" | $prompt | cut -d ")" -f 1)"
|
||||
[ -n "$link_num" ] && sxbm open "$link_num"
|
||||
[ -n "$link_num" ] && sxbm open -f "$link_num"
|
||||
}
|
||||
|
||||
bm_yank() {
|
||||
@ -21,7 +20,13 @@ bm_yank() {
|
||||
}
|
||||
|
||||
bm_add() {
|
||||
sxbm add "$@" 2>&1 | xargs -I{} $prompt -p {}
|
||||
echo | $prompt -p "Add bookmark:" | xargs sxbm add | dmenu
|
||||
}
|
||||
|
||||
bm_remove() {
|
||||
link_num="$(sxbm ls -c "$@" | $prompt | cut -d ")" -f 1)"
|
||||
link_title="$(sxbm ls -c | sed -n "${link_num}p" | cut -d ' ' -f 3)"
|
||||
[ -n "$link_num" ] && printf "y\nn" | $prompt -p "Delete this link? $link_title" | sxbm rm "$link_num"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -31,6 +36,9 @@ case "$1" in
|
||||
"-y"|"--yank")
|
||||
shift && bm_yank "$@"
|
||||
;;
|
||||
"-r"|"--remove")
|
||||
shift && bm_remove "$@"
|
||||
;;
|
||||
*)
|
||||
bm_open "$@"
|
||||
;;
|
||||
|
||||
6
sxbm
6
sxbm
@ -131,11 +131,11 @@ bm_list() {
|
||||
|
||||
if [ -n "$query_tag" ] && [ -n "$query_title" ]; then
|
||||
{ __awk_search "$query_tag" & __awk_search "$query_title"; } |
|
||||
sort | uniq -d
|
||||
sort | uniq -d | tr -s " "
|
||||
elif [ -n "$query_title" ] && [ -z "$query_tag" ]; then
|
||||
__awk_search "$query_title"
|
||||
__awk_search "$query_title" | tr -s " "
|
||||
else
|
||||
__awk_search "$query_tag"
|
||||
__awk_search "$query_tag" | tr -s " "
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user