| Make env variables for common used opener binaries and removal of code that tries to find fallbacks. - plumber - Plumber – a modern approach to plumbing |
| git clone git://r-36.net/plumber |
| Log |
| Files |
| Refs |
| README |
| LICENSE |
| --- |
| commit 2557114b5b8017213e7aaf344dcd40576fe1c53f |
| parent 055f6b3b2b6ab2c51804fd991e6347d65ca48f3c |
| Author: Ian Jones |
| Date: Wed, 12 Jul 2023 16:45:41 +0100
Make env variables for common used opener binaries and removal of code that tries to find fallbacks.
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
M Makefile | 12 +++++++++++-
M openers/gopheropener | 15 +++------------
M openers/imageopener | 3 ++-
M openers/mediaopener | 2 +-
M openers/paperopener | 4 +---
M openers/pdfopener | 2 +-
M openers/textgopheropener | 2 +-
M openers/textwebopener | 2 +-
M openers/webopener | 4 ++--
M openers/ytopener | 7 +------
10 files changed, 24 insertions(+), 29 deletions(-)
--- |
| diff --git a/Makefile b/Makefile |
| @@ -17,7 +17,17 @@ install:
cp -a bin/plumb $(INSTALL_PATH)
cp -a bin/Þ $(INSTALL_PATH)
cp openers/* $(INSTALL_PATH)
- @echo "\nRemember to 'export XTERM=' and add it to .mkshrc or .bashrc to make permanent.\n"
+ @echo "\nRemember to add the following to .mkshrc or .bashrc, .xsession or .xinitrc in Xorg, to make permanent:\n"
+ @echo "export XTERM="
+ @echo "export PLUMB_IMAGE="
+ @echo "export PLUMB_MEDIA="
+ @echo "export PLUMB_GOPHER="
+ @echo "export PLUMB_TXTGOPHER="
+ @echo "export PLUMB_PDF="
+ @echo "export PLUMB_FILEMANAGER="
+ @echo "export PLUMB_WEB="
+ @echo "export PLUMB_TXTWEB=\n"
+
uninstall:
@echo "Uninstalling from $(INSTALL_PATH)\n"
cd $(INSTALL_PATH);\ |
| diff --git a/openers/gopheropener b/openers/gopheropener |
| @@ -1,27 +1,18 @@
#!/bin/sh
-options="sacc gopher lynx w3m"
-
if [ $# -lt 1 ];
then
printf "usage: %s URI\n" "$(basename "$0")" >&2
exit 1
fi
+mkdir -p $HOME/Downloads
cd $HOME/Downloads
-opener=
-for i in $options; do
- if [ -x "$(command -v $i)" ]; then
- opener="$i"
- break
- fi
-done
-
uri=$1
-if [ "$opener" != "sacc" ]; then
+if [ "$PLUMB_GOPHER" != "sacc" ]; then
uri=$(echo "$1" | sed s/^gophers/gopher/)
fi
-$XTERM -e sh -c "$opener \"$uri\"" &
+$XTERM -e sh -c "$PLUMB_GOPHER \"$uri\"" &
|
| diff --git a/openers/imageopener b/openers/imageopener |
| @@ -17,5 +17,6 @@ esac
curl -s \
--user-agent "Lynx/2.8.8dev.3 libwww-FM/2.14 SSL-MM/1.4.1" \
-Lkz "$file" -O "$1"
-see "${file}"
+
+$PLUMB_IMAGE "${file}"
|
| diff --git a/openers/mediaopener b/openers/mediaopener |
| @@ -6,7 +6,7 @@ then
exit 1
fi
-$XTERM -e sh -c "mpv \"$1\"" &
+$XTERM -e sh -c "$PLUMB_MEDIA \"$1\"" &
## if mpv doesn't understand gopher ##
#if [ $(expr "$1" : "^gopher://") -eq 9 ]; |
| diff --git a/openers/paperopener b/openers/paperopener |
| @@ -6,9 +6,7 @@ then
exit 1
fi
-[ -z "$FILEMANAGER" ] && FILEMANAGER="ranger"
-
URI="$(printf "%s" "$1" | cut -d':' -f 2-)"
-$XTERM -e sh -c "cd \"${URI}\" && ${FILEMANAGER}"
+$XTERM -e sh -c "cd \"${URI}\" && ${PLUMB_FILEMANAGER}"
|
| diff --git a/openers/pdfopener b/openers/pdfopener |
| @@ -18,5 +18,5 @@ case "$1" in
;;
esac
-see "${file}"
+$PLUMB_PDF "${file}"
|
| diff --git a/openers/textgopheropener b/openers/textgopheropener |
| @@ -7,5 +7,5 @@ then
fi
cd $HOME/Downloads
-$XTERM -e sh -c "lynx \"$1\""
+$XTERM -e sh -c "$PLUMB_TXTGOPHER \"$1\""
|
| diff --git a/openers/textwebopener b/openers/textwebopener |
| @@ -7,5 +7,5 @@ then
fi
cd $HOME/Downloads
-$XTERM -e sh -c "w3m \"$1\""
+$XTERM -e sh -c "$PLUMB_TXTWEB \"$1\""
|
| diff --git a/openers/webopener b/openers/webopener |
| @@ -18,8 +18,8 @@ MATCH_URI = 1<<1
MATCH_ALL = 0xFF
webrules = [
- [".*", {"X-Future": ".*opher.*"}, MATCH_HEADER, "surf-open.sh '%s'"],
- [".*", {}, MATCH_ALL, "surf-open.sh '%s'"],
+ [".*", {"X-Future": ".*opher.*"}, MATCH_HEADER, os.environ.get('PLUMB_WEB') + " '%s'"],
+ [".*", {}, MATCH_ALL, os.environ.get('PLUMB_WEB') + " '%s'"],
]
def usage(app): |
| diff --git a/openers/ytopener b/openers/ytopener |
| @@ -19,12 +19,7 @@ else
export CACA_DRIVER="ncurses"
mplayer -vo caca "$uri"
else
- if [ -n "$MEDIAPLAYER" ];
- then
- $MEDIAPLAYER "$uri"
- else
- mpv "$uri"
- fi
+ $PLUMB_MEDIA "$uri"
fi
fi
|