1 #!/bin/bash
   2 
   3 title="-T ${1^}"
   4 start(){ i3-sensible-terminal $title -e "bash -ic '$@'"; }
   5 dmenu(){ rofi -columns 3 -dmenu -i -l 6 -p "${1^}" "${@:1}"; }
   6 
   7 case ${1,,} in
   8     apps) rofi -show drun -columns 2 -show-icons -terminal $0;;
   9     windows) rofi -show window;;
  10     calendar) start calcurse;;
  11 
  12     files) start ranger;;
  13     browser) chromium --new-window lexa.by &;;
  14     editor) gvim;;
  15     terminal) i3-sensible-terminal;;
  16 
  17     mail) start mutt;;
  18     news) start newsboat;;
  19     torrents) start transmission-remote-cli;;
  20     bloge)
  21         { echo ' '; blo.sh -l | tac; } | dmenu $1 |
  22         cut -d . -f 1 | xargs -r0 $0 blo.sh
  23     ;;
  24 
  25     music) start mocp;;
  26     kino)
  27         tac ~/.config/mpv/history.log | rofi -dmenu -i -p $1 |
  28         awk -F '%) - ' '{ print $2 }' | sed "s|~|$HOME|" |
  29         xargs -I % mpv --profile pseudo-gui '%'
  30     ;;
  31 
  32     -l) grep -Po '^\s+[\w^)]+\)' $0 | tr -d ') ' | sort;;
  33     --list) $0 -l | while read i; do echo "$(status.sh -i $i) ${i^}"; done;;
  34 
  35     weather) status.sh -n weather;;
  36     redshift) killall redshift || redshift -r;;
  37     theme)
  38         wal --theme | grep '^ -' | cut -b 4- | sort -u |
  39         dmenu $1 | cut -d ' ' -f 1 | xargs -r wal.sh --theme
  40     ;;
  41 
  42     '') $0 --list | dmenu | awk '{ print $NF }' | xargs -r $0;;
  43     -*) shift; title="-T ${1^}" start "$*";;
  44      *) start "$*";;
  45 esac