Simplification
This commit is contained in:
parent
0703487e4d
commit
d4da13c3ea
6 changed files with 55 additions and 68 deletions
|
@ -2,25 +2,30 @@
|
|||
|
||||
bookmarks="${BOOKMARKS:-"$HOME/.config/qutebrowser/bookmarks/urls"}"
|
||||
|
||||
usage(){ printf "Usage: %s -s|f|r|d|R|h\n" $(basename $0); }
|
||||
usage(){ printf "Usage: %s -R|h|c\n" $(basename $0); }
|
||||
|
||||
copy(){
|
||||
random(){
|
||||
shuf -n1 $bookmarks | awk '{print $1}' | xclip -sel clip
|
||||
xclip -o -sel clip
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && usage && exit 2
|
||||
while getopts sfrdRh name; do
|
||||
default(){
|
||||
if [ -z ${MENU} ]
|
||||
then printf 'err: $MENU not set\n' && exit 2
|
||||
else export menu="${MENU}"
|
||||
fi
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && default
|
||||
|
||||
while getopts Rhc: name; do
|
||||
case $name in
|
||||
f) menu="fzf";;
|
||||
r) menu="rofi -dmenu -i -p 'Bookmarks'";;
|
||||
s) menu="sk";;
|
||||
d) menu="${MENU}";;
|
||||
R) copy ;;
|
||||
R) random ;;
|
||||
h) usage ;;
|
||||
*) usage
|
||||
exit 2;;
|
||||
c) menu="$OPTARG";;
|
||||
esac
|
||||
done
|
||||
|
||||
choice="$(sort $bookmarks | $menu )"
|
||||
|
||||
[ -z "$choice" ] || echo "$choice" | awk '{print$1}' | xclip -sel clip
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
usage(){ printf "Usage: %s -s|f|r|d|R|h\n" $(basename $0); }
|
||||
[ $# -eq 0 ] && usage && exit 2
|
||||
usage(){ printf "Usage: %s -R|h|c\n" $(basename $0); }
|
||||
|
||||
bookmarks="${BOOKMARKS:-"$HOME/.config/qutebrowser/bookmarks/urls"}"
|
||||
while getopts sfrdRh name; do
|
||||
|
||||
default(){
|
||||
if [ -z ${MENU} ]
|
||||
then printf 'err: $MENU not set\n' && exit 2
|
||||
else export menu="${MENU}"
|
||||
fi
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && default
|
||||
|
||||
while getopts Rhc: name; do
|
||||
case $name in
|
||||
f) menu="fzf";;
|
||||
r) menu="rofi -dmenu -i -p 'Bookmarks'";;
|
||||
s) menu="sk";;
|
||||
d) menu="${MENU}";;
|
||||
R) xdg-open "$(shuf -n1 $bookmarks | awk '{print $1}')";;
|
||||
h) usage ;;
|
||||
*) usage
|
||||
exit 2;;
|
||||
h) usage;;
|
||||
c) menu="$OPTARG";;
|
||||
esac
|
||||
done
|
||||
|
||||
choice="$(sort $bookmarks | $menu )"
|
||||
|
||||
[ -z "$choice" ] || xdg-open "$(echo "$choice" | awk '{print$1}')"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue