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

while true
do
    dir="$(printf '%s' "$PWD" | sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g")"
	file=$(find . -maxdepth 1 -mindepth 1 -not -name '.*' -printf '%y\t%f\n' |
		sort -k 1 -k 2 | cut -f 2- |
		commander -xc -p "$dir")

	[ "$file" ] || break
	[ ! -e "$file" ] && continue

	if [ -d "$file" ]
	then
		cd "$file" || continue
	else
		setsid xdg-open "$PWD/$file" &
	fi

done