ive been looking for dmenu file manager , for some reason dmenufm doesn’t work for me it gives me no program selected falling back to dmenu so ive been googling and found these but the one doesn’t open anything and the other ones uses xdg-open but doesn’t show hidden files if anyone could help combine the two to show hidden files and open them that would be great
#!/bin/sh
# TODO: multisel
target="$1"
[ -z "$target" ] && target="$(realpath .)"
prompt="$2"
while true; do
p="$prompt"
[ -z "$p" ] && p="$target"
sel="$(ls -1a "$target" |grep -v '^\.$' | dmenu -p "$p" -l 25)"
ec=$?
[ "$ec" -ne 0 ] && exit $ec
c="$(echo "$sel" |cut -b1)"
if [ "$c" = "/" ]; then
newt="$sel"
else
newt="$(realpath "${target}/${sel}")"
fi
if [ -e "$newt" ]; then
target="$newt"
if [ ! -d "$target" ]; then
echo "$target"
exit 0
fi
fi
done
#!/bin/sh
handle_file() {
if [ -d "$1" ]; then
cd "$1"
elif [ -f "$1" ]; then
exec xdg-open "$(pwd)/$1" &
exit 0
else
printf "%s is neither a file nor a directory\n" "$(pwd)/$1" >&2
fi
}
needed=("xdg-open" "dmenu")
for n in "${needed[@]}"; do
if ! which "$n" &> /dev/null; then
printf "Please install %s in order to use this script!\n" "$n" >&2
exit 1
fi
done
while : ; do
file="$(ls -1 --group-directories-first | dmenu -l 10 -p "Browse $(basename $(pwd)):")"
if [ -e "$file" ]; then
handle_file "$file"
else
break
fi
done