From 067b07eb24262b34c00fe7be786cbdcfcd6383c6 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 19 Oct 2023 11:22:31 +0200 Subject: refactor --- bin/guiscripts/dmfm | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'bin/guiscripts/dmfm') diff --git a/bin/guiscripts/dmfm b/bin/guiscripts/dmfm index 969c111..d1dd8b8 100755 --- a/bin/guiscripts/dmfm +++ b/bin/guiscripts/dmfm @@ -1,17 +1,19 @@ #!/bin/sh -file=1 -while [ "$file" ]; do - file=$(ls -1 --group-directories-first | dmenu -i -l 8 -g 1 -p "$(basename $(pwd)):") - if [ -e "$file" ]; then - owd=$(pwd) - if [ -d "$file" ]; then - cd "$file" - else [ -f "$file" ] - if which xdg-open &> /dev/null; then - exec xdg-open "$owd/$file" & - unset file - fi - fi +while true +do + file=$(find . -maxdepth 1 -mindepth 1 -not -name '.*' -printf '%y\t%f\n' | + sort -k 1 -k 2 | cut -f 2- | + commander -xcd -p "$PWD>") + + [ "$file" ] || break + [ ! -e "$file" ] && continue + + if [ -d "$file" ] + then + cd "$file" || continue + else + setsid xdg-open "$PWD/$file" & fi + done -- cgit v1.2.3