plumber

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

commit a961e969ebce4cadc4fd176b1ea66acee7cd23c2
parent 71bdea8e7bbb7bf427d877a6603f33384c616da2
Author: ronin <ian@contractcoder.biz>
Date:   Thu, 31 Dec 2020 12:59:46 +0000

* Removed hard coded terminal type and replaced with XTERM env var. * Added fallback of lynx if sacc is not installed. * Added workaround for mpv not understanding gopher URIs.

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

Diffstat:
README.md | 2++
openers/dhlopener | 2+-
openers/dictopener | 2+-
openers/fileopener | 2+-
openers/fingeropener | 4++--
openers/ftpopener | 2+-
openers/gopheropener | 4+++-
openers/ldapopener | 2+-
openers/mediaopener | 9+++++++--
openers/pageropener | 4++--
openers/paperopener | 2+-
openers/portageopener | 2+-
openers/rfcopener | 2+-
openers/rpopener | 2+-
openers/scmopener | 2+-
openers/sshopener | 2+-
openers/telnetopener | 2+-
openers/textgopheropener | 2+-
openers/textwebopener | 2+-
openers/wikiopener | 2+-
20 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/README.md b/README.md @@ -26,6 +26,8 @@ See the LICENSE file for the terms. % cp openers/* $HOME/bin # Required for dwm integration: % cp bin/opener $HOME/bin + % export XTERM=<your_preferred_xterminal> + # Add the above to your .mkshrc or .bashrc to make permanent. ## Usage diff --git a/openers/dhlopener b/openers/dhlopener @@ -8,5 +8,5 @@ fi URI="$(printf "%s" "$1" | cut -d':' -f 2-)" -st -e sh -c "dhl-tracking \"${URI}\" | \$PAGER;" +$XTERM -e sh -c "dhl-tracking \"${URI}\" | \$PAGER;" diff --git a/openers/dictopener b/openers/dictopener @@ -20,5 +20,5 @@ dict:*) esac [ -z "$PAGER" ] && PAGER="less" -st -e sh -c "dict \"$argument\" | $PAGER" +$XTERM -e sh -c "dict \"$argument\" | $PAGER" diff --git a/openers/fileopener b/openers/fileopener @@ -10,7 +10,7 @@ path="$1" if [ -d "$path" ]; then [ -z "$SHELL" ] && SHELL="/bin/sh" - st -e /bin/sh -c "cd \"${path}\"; $SHELL" >&2 >/dev/null & + $XTERM /bin/sh -c "cd \"${path}\"; $SHELL" >&2 >/dev/null & exit 0 fi diff --git a/openers/fingeropener b/openers/fingeropener @@ -56,9 +56,9 @@ def main(args): return 1 if req == "": - runcmd("st -e sh -c \"finger -l; read;\"") + runcmd("$XTERM -e sh -c \"finger -l; read;\"") else: - runcmd("st -e sh -c \"finger -l '%s'; read;\"", req) + runcmd("$XTERM -e sh -c \"finger -l '%s'; read;\"", req) return 0 diff --git a/openers/ftpopener b/openers/ftpopener @@ -6,5 +6,5 @@ then exit 1 fi -st -e sh -c "lftp \"$1\"" +$XTERM -e sh -c "lftp \"$1\"" diff --git a/openers/gopheropener b/openers/gopheropener @@ -7,5 +7,7 @@ then fi cd $HOME/Downloads -st -e sh -c "sacc \"$1\"" & + +opener=$([ -x "$(command -v sacc)" ] && echo "sacc" || echo "lynx") +$XTERM -e sh -c "$opener \"$1\"" & diff --git a/openers/ldapopener b/openers/ldapopener @@ -6,5 +6,5 @@ then exit 1 fi -st -e sh -c "shelldap \"$1\"" +$XTERM -e sh -c "shelldap \"$1\"" diff --git a/openers/mediaopener b/openers/mediaopener @@ -6,5 +6,10 @@ then exit 1 fi -st -e sh -c "mpv \"$1\"" & - +## mpv doesn't understand gopher ## +if [ $(expr "$1" : "^gopher://") -eq 9 ]; +then + $XTERM -e sh -c "curl -s \"$1\" | mpv -" & +else + $XTERM -e sh -c "mpv \"$1\"" & +fi diff --git a/openers/pageropener b/openers/pageropener @@ -24,11 +24,11 @@ then else if [ -d "${f}" ]; then - st -e sh -c "cd \"${f}\"; $SHELL" + $XTERM -e sh -c "cd \"${f}\"; $SHELL" else if [ -e "${f}" ]; then - st -e sh -c "$PAGER \"${f}\"" + $XTERM -e sh -c "$PAGER \"${f}\"" fi fi fi diff --git a/openers/paperopener b/openers/paperopener @@ -10,5 +10,5 @@ fi URI="$(printf "%s" "$1" | cut -d':' -f 2-)" -st -e sh -c "cd \"${URI}\" && ${FILEMANAGER}" +$XTERM -e sh -c "cd \"${URI}\" && ${FILEMANAGER}" diff --git a/openers/portageopener b/openers/portageopener @@ -8,5 +8,5 @@ fi URI="$(printf "%s" "$1" | cut -d':' -f 2-)" -st -e sh -c "esearch \"${URI}\" | \$PAGER;" +$XTERM -e sh -c "esearch \"${URI}\" | \$PAGER;" diff --git a/openers/rfcopener b/openers/rfcopener @@ -8,5 +8,5 @@ fi URI="$(printf "%s" "$1" | cut -d':' -f 2-)" -st -e sh -c "rfc \"rfc${URI}\"" +$XTERM -e sh -c "rfc \"rfc${URI}\"" diff --git a/openers/rpopener b/openers/rpopener @@ -30,6 +30,6 @@ if [ "${rpcmd}" = "rpopen" ]; then rpopen -c "${account}" -m "${mailbox}" "${ids}" else - st -e sh -c "${rpcmd} -c \"${account}\" -m \"${mailbox}\" \"${ids}\"" + $XTERM -e sh -c "${rpcmd} -c \"${account}\" -m \"${mailbox}\" \"${ids}\"" fi diff --git a/openers/scmopener b/openers/scmopener @@ -12,7 +12,7 @@ path="$SCM/$(printf "%s\n" "$1" | cut -d':' -f 2-)" if [ -d "$path" ]; then [ -z "$SHELL" ] && SHELL="/bin/sh" - st -e /bin/sh -c "cd \"${path}\"; $SHELL" >&2 >/dev/null & + $XTERM /bin/sh -c "cd \"${path}\"; $SHELL" >&2 >/dev/null & exit 0 fi diff --git a/openers/sshopener b/openers/sshopener @@ -25,7 +25,7 @@ port="$(printf "%s\n" "$uri" \ | cut -d '/' -f 1)" [ -z "$port" ] && port="22" -st -e sh -c \ +$XTERM -e sh -c \ "printf \"URI: %s\n\" "${uri}"; \ ssh -p \"${port}\" \"${host}\"; \ read;" \ diff --git a/openers/telnetopener b/openers/telnetopener @@ -9,5 +9,5 @@ then fi cd $HOME/Downloads -st -e sh -c "telnetopenerchild \"$1\"" +$XTERM -e sh -c "telnetopenerchild \"$1\"" diff --git a/openers/textgopheropener b/openers/textgopheropener @@ -7,5 +7,5 @@ then fi cd $HOME/Downloads -st -e sh -c "lynx \"$1\"" +$XTERM -e sh -c "lynx \"$1\"" diff --git a/openers/textwebopener b/openers/textwebopener @@ -7,5 +7,5 @@ then fi cd $HOME/Downloads -st -e sh -c "w3m \"$1\"" +$XTERM -e sh -c "w3m \"$1\"" diff --git a/openers/wikiopener b/openers/wikiopener @@ -8,5 +8,5 @@ fi URI="$(printf "%s" "$1" | cut -d':' -f 2-)" -st -e sh -c "wiki -e \"${URI}\";" +$XTERM -e sh -c "wiki -e \"${URI}\";"