Pushing dmenu and related scripts.

This commit is contained in:
Derek Taylor
2019-01-29 18:22:13 -06:00
parent a675369bd8
commit 386a83e584
6 changed files with 146 additions and 0 deletions

29
.dmenu/dbrowse Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
# TODO: multisel
target="$1"
[ -z "$target" ] && target="$(realpath .)"
prompt="$2"
while true; do
p="$prompt"
[ -z "$p" ] && p="$target"
sel="$(ls -1a "$target" |grep -v '^\.$' | dmenu -p "$p" -l 25)"
ec=$?
[ "$ec" -ne 0 ] && exit $ec
c="$(echo "$sel" |cut -b1)"
if [ "$c" = "/" ]; then
newt="$sel"
else
newt="$(realpath "${target}/${sel}")"
fi
if [ -e "$newt" ]; then
target="$newt"
if [ ! -d "$target" ]; then
echo "$target"
exit 0
fi
fi
done