1 #!/bin/bash
   2 
   3 shopt -s nocasematch
   4 dmenu(){ rofi -dmenu -i -p "$1:"; }
   5 start(){ xterm -title "${1^}" -e bash -ic "$@" & }
   6 
   7 if [[ $TMUX ]]; then
   8     gvim(){ vim; }
   9     rofi(){ fzf "${@:5}"; }
  10     start(){ tmux neww -n $1 "$@"; }
  11 fi
  12 
  13 [[ $# == 0 ]] &&
  14 grep -o '^\s\+\w\+)' $0 | sed 's/[) ]//g' | sort -k 2
  15 
  16 while (($# > 0)); do
  17     case $1 in
  18         files) start ranger;;
  19         editor) gvim --role pop-up;;
  20         shell) start 'tmux attach -t Shell || tmux new -s Shell';;
  21 
  22         music) start mocp;;
  23         calendar) start calcurse;;
  24         contacts) start abook;;
  25 
  26         mail) start mutt;;
  27         news) start newsbeuter;;
  28         torrents) start transmission-remote-cli;;
  29 
  30         browser) www.sh l;;
  31         www) www.sh $(www.sh | cut -d ' ' -f 2 | dmenu WWW);;
  32 
  33         color) gpick;;
  34         windows) rofi -show window;;
  35         apps) rofi -show drun -modi drun,run -sidebar-mode;;
  36 
  37         start) $0 $($0 | sed 's/.*/\u&/' | dmenu Start);;
  38         audio) audio.sh $(audio.sh | dmenu Device | cut -f 2);;
  39 
  40         *) start "$1";;
  41     esac
  42     shift
  43 done
[raw]