From 4388e67fba3b41e01dcfc868ea93ebaca382b42c Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Fri, 20 Oct 2023 15:54:53 +0200 Subject: [PATCH] Random bookmark option --- src/bin/open-bookmark | 5 +++-- src/manpages/open-bookmark.1.scd | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bin/open-bookmark b/src/bin/open-bookmark index 4ec3c9e..71993a7 100755 --- a/src/bin/open-bookmark +++ b/src/bin/open-bookmark @@ -1,16 +1,17 @@ #!/bin/sh usage(){ - printf "Usage: %s -s|f|r|d|h\n" $(basename $0) + printf "Usage: %s -s|f|r|d|R|h\n" $(basename $0) } bookmarks="${BOOKMARKS:-"$HOME/.config/qutebrowser/bookmarks/urls"}" -while getopts sfrdh name; do +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) xdg-open "$(shuf -n1 $bookmarks | awk '{print $1}')";; h) usage ;; *) usage exit 2;; diff --git a/src/manpages/open-bookmark.1.scd b/src/manpages/open-bookmark.1.scd index 1e3fe7c..d375888 100644 --- a/src/manpages/open-bookmark.1.scd +++ b/src/manpages/open-bookmark.1.scd @@ -6,7 +6,7 @@ open-bookmark(1) # SYNOPSIS -*open-bookmark -s|f|r|d|h* +*open-bookmark -s|f|r|d|R|h* # DESCRIPTION *qutebrowser(1)* saves its bookmarks in @@ -28,6 +28,9 @@ qutebrowser sometimes. Hence this script now exists. *-d* use *$MENU* to select bookmark +*-R* + open random bookmark + *-h* print usage and exit