You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
646 B

4 years ago
#!/usr/bin/env sh
EDITOR=vis
cd "/home/$USER/" || exit 1
4 years ago
handlefiles() {
echo "$1" | grep -iE ".(wav|webm|mp4|ogg|opus|m4a|flac|mov|avi)$" && st -e mpv "$@" && exit
echo "$1" | grep -iE ".(jpg|png|gif)$" && st -e sxiv "$@" && exit
st -e sh -ic "$EDITOR $*" && exit
4 years ago
}
while true; do
CHOICES="$(printf %b 'Close Menu\n../\n*\n'"$(ls -1p)")"
DIR="$(basename "$(pwd)")"
PICKED="$(
echo "$CHOICES" |
dmenu -fn Terminus-18 -c -p "$DIR" -l 20
)"
4 years ago
echo "$PICKED" | grep "Close Menu" && exit 0
[ -d "$PICKED" ] && cd "$PICKED" && continue
echo "$PICKED" | grep -E '^[*]$' && handlefiles ./*
[ -f "$PICKED" ] && handlefiles "$PICKED"
4 years ago
done