scripts

scripts
git clone git://git.wimdupont.com/scripts.git
Log | Files | Refs | README | LICENSE

commit 8c3beab203b83087917b8cbfb1d33435718b9e44
parent 642ba34e6edb64f4da7e58c033571087b5aa156f
Author: Wim Dupont <wim@wimdupont.com>
Date:   Sat, 25 Mar 2023 20:13:39 +0100

added bookmark

Diffstat:
MREADME.adoc | 10+++++++++-
Abin/bookmark | 25+++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/README.adoc b/README.adoc @@ -3,6 +3,14 @@ For certain scripts I've added a _"requires"_ section to specify software which is less likely to be installed by default that the script uses. Most of these can be changed with alternatives by choice if willing to edit the script. +== link:bin/bookmark[bookmark] + +Uses dmenu to browse and open URL's in your browser saved in a textfile (default in ~/.config/scripts/bookmarks). + +.Requires: + +* https://git.suckless.org/dmenu/[dmenu] + == link:bin/coin[coin] Used to grab cryptocurrency data, including market price. The data itself is powered by CoinGecko API. @@ -61,7 +69,7 @@ for the same name as the chosen file then pass-otp will be used to copy the OTP == link:bin/radio[radio] -Uses dmenu to browse and play online radio stations saved in a textfile (default in ~/Desktop/radiostations). The textfile should consist of a searchname and the URL separated by a semicolon (;) and with a new line for each new station. +Uses dmenu to browse and play online radio stations saved in a textfile (default in ~/.config/scripts/radiostations). The textfile should consist of a searchname and the URL separated by a semicolon (;) and with a new line for each new station. .Requires: diff --git a/bin/bookmark b/bin/bookmark @@ -0,0 +1,25 @@ +#!/bin/bash + +source ~/.config/scripts/properties + +shopt -s nullglob globstar + +font=$DMENU_FONT +lines=$DMENU_LINES + +dmenu=dmenu +file=~/.config/scripts/bookmarks + +readarray -t bookmarks < "$file" + +bookmark=$(printf '%s\n' "${bookmarks[@]}" | "$dmenu" -fn "$font" -i -l "$lines" "$@") + +if [ -z "${bookmark}" ]; then + exit 0 +fi + +if [[ "${bookmark}" != https://* ]]; then + bookmark="http://localhost/search?q=${bookmark}" +fi + +xdg-open "${bookmark}" >/dev/null 2>&1 & disown