diff --git a/src/bin/copy-bookmark b/src/bin/copy-bookmark index 7f809cc..bf9676e 100755 --- a/src/bin/copy-bookmark +++ b/src/bin/copy-bookmark @@ -1,15 +1,22 @@ #!/bin/sh -usage(){ printf "Usage: %s -s|f|r|d|R|h\n" $(basename $0); } -[ $# -eq 0 ] && usage && exit 2 bookmarks="${BOOKMARKS:-"$HOME/.config/qutebrowser/bookmarks/urls"}" + +usage(){ printf "Usage: %s -s|f|r|d|R|h\n" $(basename $0); } + +copy(){ + shuf -n1 $bookmarks | awk '{print $1}' | xclip -sel clip + xclip -o -sel clip +} + +[ $# -eq 0 ] && usage && exit 2 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;; + R) copy ;; h) usage ;; *) usage exit 2;;