eedmenu.in 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. . <(ffoom init)
  3. ffoo import core
  4. ffoo import ini
  5. FFOO_INI_PATH="__FFOO_INI_PATH__"
  6. usage() {
  7. usage_is "[-l|--lines] [-d|--delim] [-e|--read-eeini]"
  8. }
  9. numbered=false
  10. lines=10
  11. maybe_cut=cat
  12. maybe_read_eeini=cat
  13. while true; do case $1 in
  14. -l|--lines) lines=$2; shift 2 ;;
  15. -d|--delim) delim=$2; shift 2 ;;
  16. -e|--read-eeini) read_eeini=$2; delim='='; shift 2 ;;
  17. "") break ;;
  18. *) usage
  19. esac done
  20. test -n "$delim" && maybe_cut=do_cut
  21. test -n "$read_eeini" && maybe_read_eeini=do_read_eeini
  22. host=$(hostname -s)
  23. nb="$(iniread -p style.color.nbg)"
  24. nf="$(iniread -p style.color.nfg)"
  25. sb="$(iniread -p style.color.sng)"
  26. sf="$(iniread -p style.color.sfg)"
  27. fn="$(iniread -p style.font)"
  28. fn=${fn:--*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*}
  29. arg_nb="${nb:+-nb $nb}"
  30. arg_nf="${nf:+-nf $nf}"
  31. arg_sb="${sb:+-sb $sb}"
  32. arg_sf="${sf:+-sf $sf}"
  33. arg_fn="${fn:+-fn $fn}"
  34. style="$arg_nb $arg_nf $arg_sb $arg_sf $arg_fn"
  35. do_cut() {
  36. cut -d$delim -f2-
  37. }
  38. do_read_eeini() {
  39. iniread $read_eeini
  40. }
  41. $maybe_read_eeini \
  42. | dmenu -l $lines $style \
  43. | $maybe_cut