aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdmenuOpen.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/dmenuOpen.sh b/dmenuOpen.sh
new file mode 100755
index 0000000..ff0a839
--- /dev/null
+++ b/dmenuOpen.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# dmenuOpen.sh
+#
+# Selects a file in a folder with dmenu and opens it with rifle
+
+set -euo pipefail
+IFS=$'\n\t'
+
+folder="$1"
+[ -z "$folder" ] && exit 0
+
+lines="$(find "$folder" -type f | wc -l)"
+selected="$(find "$folder" -type f | grep -o '[^/]*$' | dmenu -l "$lines" -p "File to open: ")"
+o "${folder}/${selected}"