aboutsummaryrefslogtreecommitdiff
path: root/dmenu-filepicker
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdmenu-filepicker13
1 files changed, 11 insertions, 2 deletions
diff --git a/dmenu-filepicker b/dmenu-filepicker
index e2642b2..288cac9 100755
--- a/dmenu-filepicker
+++ b/dmenu-filepicker
@@ -2,20 +2,29 @@
2 2
3# A dmenu-based file picker (prints selected file to stdout) 3# A dmenu-based file picker (prints selected file to stdout)
4# Requires: dmenu (or similar) 4# Requires: dmenu (or similar)
5
5# Usage: dmenu-filepicker [-m menu] [path] 6# Usage: dmenu-filepicker [-m menu] [path]
6 7
7menu="dmenu -i -l 15" 8menu="dmenu -i -l 15"
8 9
10usage() {
11 echo "Usage: dmenu-filepicker [-m MENU] [PATH]"
12}
13
9while getopts "m:" opt; do 14while getopts "m:" opt; do
10 case "$opt" in 15 case "$opt" in
11 m) 16 m)
12 menu="$OPTARG" 17 menu="$OPTARG"
13 ;; 18 ;;
19 *)
20 usage
21 exit 1
22 ;;
14 esac 23 esac
15done 24done
16shift `expr $OPTIND - 1` 25shift $((OPTIND - 1))
17 26
18fullpath=$(realpath ${@:-"$(pwd)"}) 27fullpath=$(realpath "${@:-"$(pwd)"}")
19 28
20while true; do 29while true; do
21 if [ "$sel" = "." ]; then 30 if [ "$sel" = "." ]; then

Generated with cgit - Back to sebastiano.tronto.net