plumber

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

commit f5035a1bd4cc698d9b2487574080b2cdafab2aea
parent 926420c57096a41a8fcd6838124e792d9119b433
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun, 16 Apr 2017 16:59:37 +0200

Add fileopener, to be able to open directories with shells.

Diffstat:
bin/plumber | 4++--
openers/fileopener | 20++++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/bin/plumber b/bin/plumber @@ -17,7 +17,7 @@ import logging.handlers # regexp command (%s as file) plumbrules = [ - ["^/.*", "see '%s'"], + ["^/.*", "fileopener '%s'"], ["^> .*", "run '%s'"], ["^file://.*", "mailcapopener '%s'"], ["^.*://.*wikipedia.*/.*\.(jpeg|jpg|png|gif|xpm|JPG|JPEG|PNG|XPM|GIF)$", \ @@ -72,7 +72,7 @@ plumbrules = [ ["^wiki:.*", "wikiopener '%s'"], ["^@.*", False], [".*@.*", "mailcomposer '%s'"], - [".*", ["see '%s'", "webopener '%s'"]], + [".*", ["fileopener '%s'", "webopener '%s'"]], ] menucmd = "dmenu -p \"URI to plumb> \" -i" diff --git a/openers/fileopener b/openers/fileopener @@ -0,0 +1,20 @@ +#!/bin/sh + +set -x + +if [ $# -lt 1 ]; +then + printf "usage: %s path\n" "$(basename "$0")" >&2 + exit 1 +fi + +path="$1" +if [ -d "$path" ]; +then + [ -z "$SHELL" ] && SHELL="/bin/sh" + st -e /bin/sh -c "cd \"${path}\"; $SHELL" >&2 >/dev/null & + exit 0 +fi + +see "$path" +