aboutsummaryrefslogtreecommitdiff
path: root/old
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2022-02-12 16:26:04 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2022-02-12 16:26:04 +0100
commit3f190a17b90cb3c641ca0ead72eb86ec3dd36651 (patch)
treefe0f4383d328a6aafeec6cf9ffbc585ed24a73c3 /old
parentdde2e2618499ddf4c7644418f792113fbe19b955 (diff)
downloadscripts-3f190a17b90cb3c641ca0ead72eb86ec3dd36651.tar.gz
scripts-3f190a17b90cb3c641ca0ead72eb86ec3dd36651.zip
Simplified dmenu-filepicker (but did not solve the change-of-focus problem I was trying to fix)
Diffstat (limited to '')
-rwxr-xr-xold/dmenu-filepicker-old31
1 files changed, 31 insertions, 0 deletions
diff --git a/old/dmenu-filepicker-old b/old/dmenu-filepicker-old
new file mode 100755
index 0000000..532fb82
--- /dev/null
+++ b/old/dmenu-filepicker-old
@@ -0,0 +1,31 @@
1#!/bin/sh
2
3# A dmenu-based file picker (prints selected file to stdout)
4# Requires: dmenu (or similar)
5# Usage: dmenu-filepicker [path]
6
7menu=${MENU:-dmenu}
8menuopts="-i -l 15"
9
10basedir="$(pwd)"
11
12next="${@:-$(pwd)}"
13
14while true; do
15 if [ -z "$next" ]; then
16 break
17 elif [ "$next" = "." ]; then
18 pwd
19 break
20 elif [ -d "$next" ]; then
21 cd "$next"
22 next=$(ls -a | $menu $menuopts)
23 else
24 echo "$next" | while read line; do
25 echo "$(pwd)/$line"
26 done
27 break
28 fi
29done
30
31cd "$basedir"

Generated with cgit - Back to sebastiano.tronto.net