menu (913B)
1 #!/usr/bin/env bash 2 3 draw_line () { 4 for i in {1..10}; do 5 printf "―" 6 done 7 } 8 9 menu_list=" run\n term\n web\n music\n mail\n file\n edit\n view\n todo\n calc\n man\n top\n$(draw_line)\n exit" 10 dmenucmd="dmenu -i -l $(echo -e $menu_list | wc -l)" 11 cmd=$(echo -e "$menu_list" | eval "$dmenucmd") 12 13 case $cmd in 14 *run) 15 dmenu_prog -l 20 ;; 16 *term) 17 tabbed st -w ;; 18 *web) 19 surf_open ;; 20 *music) 21 st -e cmus ;; 22 *mail) 23 st -e mutt ;; 24 *file) 25 pcmanfm > /dev/null 2>&1 ;; 26 *edit) # TODO dont open if dmenu returned empty 27 st -e vim -p "$(dmenu_browse)" ;; 28 *view) 29 sxiv "$(dmenu_browse $HOME/pictures)" ;; 30 *todo) 31 dmenu_todo ;; 32 *calc) 33 dmenu_calc -l 1;; 34 *man) 35 manprog=$(dmenu_man -l 20) 36 manname=$(echo "$manprog" | cut -d " " -f 2) 37 st -t "$manname" -e man $manprog ;; 38 *top) 39 st -g 68x6 -e htop ;; 40 *exit) 41 dmenu_quit ;; 42 *) 43 $cmd 44 esac 45 46 exit 0