dmenium

small collection of dmenu scripts
git clone git://edryd.org/dmenium
Log | Files | Refs | LICENSE

browse (528B)


      1 #!/usr/bin/env bash
      2 # TODO: multisel
      3 
      4 target="$1"
      5 [ -z "$target" ] && target="$(realpath .)"
      6 
      7 while true; do
      8     sel="$(ls -1a "$target" | grep -v '^\.$' | dmenu -i -p "$target" -l 25)"
      9     ec=$?
     10     [ "$ec" -ne 0 ] && exit $ec
     11 
     12     c="$(echo "$sel" |cut -b1)"
     13     if [ "$c" = "/" ]; then
     14         newt="$sel"
     15     else
     16         newt="$(realpath "${target}/${sel}")"
     17     fi
     18 
     19     if [ -e "$newt" ]; then
     20         target="$newt"
     21         if [ ! -d "$target" ]; then
     22             echo "$target"
     23             exit 0
     24         fi
     25     fi
     26 done