local/bin/appsmenu

   1 #!/bin/bash
   2 
   3 source ~/.theme/colors.sh
   4 f=~/.cache/${0##*/} && touch $f
   5 ln -s ~/.local/bin/{term,gnome-terminal}
   6 
   7 while read app; do
   8     echo $app >> $f
   9     gtk-launch $app
  10 done < <(
  11     dirs=(
  12         /usr/local/share/applications/
  13           ~/.local/share/applications/
  14               /usr/share/applications/
  15     )
  16     apps=$(
  17         find ${dirs[@]} -type f -name \*.desktop 2>&-   |
  18         awk -F / '{ print $NF }' | sed 's/\.desktop$//' |
  19         sort -u | grep -v krita_
  20     )
  21 
  22     join  -a 2 <(sort $f) <(echo "${apps[@]}") |
  23     cut   -d ' ' -f 1 | uniq -c | sort -k 1nr  | awk '{ print $2 }' |
  24     dmenu -i -p "$(icon apps)" -sb $yellow1
  25 )
  26 
  27 sleep 1 && rm ~/.local/bin/gnome-terminal &
  28