Copy bookmark script

This commit is contained in:
Nox Sluijtman 2023-10-20 16:07:24 +02:00
parent 4388e67fba
commit c709793a7d
4 changed files with 63 additions and 2 deletions

19
src/bin/copy-bookmark Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
usage(){ printf "Usage: %s -s|f|r|d|R|h\n" $(basename $0); }
bookmarks="${BOOKMARKS:-"$HOME/.config/qutebrowser/bookmarks/urls"}"
while getopts sfrdRh name; do
case $name in
f) menu="fzf";;
r) menu="rofi -dmenu -i -p 'Bookmarks'";;
s) menu="sk";;
d) menu="${MENU}";;
R) shuf -n1 $bookmarks | awk '{print $1}' | xclip -sel clip;;
h) usage ;;
*) usage
exit 2;;
esac
done
choice="$(sort $bookmarks | $menu )"
[ -z "$choice" ] || echo "$choice" | awk '{print$1}' | xclip -sel clip

View file

@ -0,0 +1,38 @@
open-bookmark(1)
# NAME
*copy-bookmark* - puts a *qutebrowser(1)* bookmark into *xclip(1)* clipboard
# SYNOPSIS
*open-bookmark -s|f|r|d|R|h*
# DESCRIPTION
*qutebrowser(1)* saves its bookmarks in
'*~/.config/qutebrowser/bookmarks/urls*'.
I would like to be able to access those bookmarks more easily outside of
qutebrowser sometimes. Hence this script now exists.
# OPTIONS
*-s*
use *sk(1)* to select bookmark
*-f*
use *fzf(1)* to select bookmark
*-r*
use *rofi(1)* to select bookmark
*-d*
use *$MENU* to select bookmark
*-R*
copy random bookmark
*-h*
print usage and exit
# SEE ALSO
*fzf(1)*, *sk(1)*, *rofi(1)*, *qutebrowser(1)*, *xclip(1)*

View file

@ -23,6 +23,10 @@ both problems.
*open-bookmark*
Opens a bookmark in *xdg-open(1)*, see its own manpage for more information
*copy-bookmark*
Adds a bookmark to clipboard using *xclip(1)*, see its own manpage for more
information
# SEE ALSO
*open-bookmark(1)*, *xdg-open(1)*
*open-bookmark(1)*, *xdg-open(1)*, *xclip(1)*

View file

@ -35,4 +35,4 @@ qutebrowser sometimes. Hence this script now exists.
print usage and exit
# SEE ALSO
*fzf(1)*, *sk(1)*, *rofi(1)*, *qutebrowser(1)*
*fzf(1)*, *sk(1)*, *rofi(1)*, *qutebrowser(1)*, *xdg-open(1)*