plumber

Plumber – a modern approach to plumbing
git clone git://r-36.net/plumber
Log | Files | Refs | README | LICENSE

commit 055f6b3b2b6ab2c51804fd991e6347d65ca48f3c
parent 6e905f1b6294e0f87dd626318127be0c5a1b399c
Author: Ian Jones <ian@contractcoder.biz>
Date:   Sun, 21 May 2023 18:36:36 +0100

Try to find suitable gopher browser and change gophers url for those not capable.

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
Mopeners/gopheropener | 18++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/openers/gopheropener b/openers/gopheropener @@ -1,5 +1,7 @@ #!/bin/sh +options="sacc gopher lynx w3m" + if [ $# -lt 1 ]; then printf "usage: %s URI\n" "$(basename "$0")" >&2 @@ -8,6 +10,18 @@ fi cd $HOME/Downloads -opener=$([ -x "$(command -v sacc)" ] && echo "sacc" || echo "lynx") -$XTERM -e sh -c "$opener \"$1\"" & +opener= +for i in $options; do + if [ -x "$(command -v $i)" ]; then + opener="$i" + break + fi +done + +uri=$1 +if [ "$opener" != "sacc" ]; then + uri=$(echo "$1" | sed s/^gophers/gopher/) +fi + +$XTERM -e sh -c "$opener \"$uri\"" &