summaryrefslogtreecommitdiff
path: root/bin/guiscripts/dmfm
blob: b7a68d22b92ae8db9158299ba999ec09104c505a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

[ -d "$1" ] && cd "$1"

while true; do
	choice=$(find . -maxdepth 1 -mindepth 1 -not -name '.*' -printf '%y\t%f\n' |
		sort -k 1 -k 2 | cut -f 2- |
		dmenu -x -c -i -p "$(pwd)")

	[ "$choice" ] || break
	[ -e "$choice" ] || continue

	if [ -d "$choice" ]; then
		cd "$choice" || continue
	else
		setsid xdg-open "$choice" &
		exit
	fi

done