commit 78d370bf58ea1779fbc4ed4481e116db58306d99
parent 8359e51fc4717bb000826d026deecef0f6603f9d
Author: clamiax <smoppy@gmail.com>
Date: Sat, 17 Oct 2015 16:35:21 +0200
Add the browse script.
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -115,3 +115,7 @@ services which I use to deal with my web stack (redis, mysql, nginx, etc.).
droid
-----
Sane Android Development.
+
+browse
+------
+Little dmenu-based file browser which uses MIME to open files.
diff --git a/browse b/browse
@@ -0,0 +1,19 @@
+#!/bin/sh
+# TODO: multisel
+
+TARGET="$1"
+[ -z "$TARGET" ] && TARGET=.
+run=true
+
+while "$run"; do
+ if [ ! -d "$TARGET" ]; then
+ mimeopen "$TARGET"
+ exit 0
+ fi
+
+ cd "$TARGET"
+ sel="$(ls -1a "$TARGET" |grep -v '^\.$' | dmenu -l 25)"
+ ec=$?
+ [ "$ec" -ne 0 ] && exit $ec
+ TARGET="$(realpath "$sel")"
+done