[download]

local/bin/games-menu

   1 #!/bin/bash
   2 
   3 cd ~/Games || exit
   4 
   5 declare -A map
   6 
   7 while read i; do
   8     a=${i%%/*} b=${i##*/}
   9     [[ ${b,,} == *uninstall* ]] && continue
  10 
  11     if [[ ${a,,} == "${b,,}" ]];then
  12         map[$a]=$i
  13     else
  14         map[$a/$b]=$i
  15     fi
  16 done < <(
  17     find * -type f -executable -exec file -i0 {} \+ |
  18     grep -a exec | cut -d $'\0' -f 1
  19 )
  20 
  21 printf '%s\n' "${!map[@]}" | sort |
  22 menu -i games -l 15 | while read i; do
  23     i=${map[$i]}
  24     cd "${i%/*}" &&
  25 
  26     if [[ ${i,,} == *.exe ]]; then
  27         wine "${i##*/}" &
  28     else
  29         "./${i##*/}" &
  30     fi
  31 done