From 3f2a0ae3cd41ebac8aa4e6d1b9d9cadd7874fe3a Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Fri, 20 Oct 2023 18:26:29 +0200 Subject: [PATCH] Because 'tee' doesn't behave like I expect it to --- src/bin/copy-bookmark | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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;;