saturnin-dmenu 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. . $(ffoom path)
  3. ffoo import config
  4. ffoo import pretty
  5. usage() {
  6. usage_is "[-l|--lines NUM] [--split CHAR] ARGS..."
  7. }
  8. numbered=false
  9. lines=10
  10. maybe_split=cat
  11. delim=" "
  12. field=2-
  13. while true; do case $1 in
  14. -l|--lines) lines=$2; shift 2 ;;
  15. --split) delim=$2; maybe_split=do_split; shift 2 ;;
  16. --split-field) field=$2; maybe_split=do_split; shift 2 ;;
  17. --help|--usage) usage ;;
  18. *) break ;;
  19. esac done
  20. nb="$(inigrep -p style.color.nbg)"
  21. nf="$(inigrep -p style.color.nfg)"
  22. sb="$(inigrep -p style.color.sbg)"
  23. sf="$(inigrep -p style.color.sfg)"
  24. fn="$(inigrep -p style.font)"
  25. fn=${fn:--*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*}
  26. debug -v nb nf sb sf fn lines maybe_split delim
  27. style() {
  28. test -n "$nb" && echo -n "-nb $nb "
  29. test -n "$nf" && echo -n "-nf $nf "
  30. test -n "$sb" && echo -n "-sb $sb "
  31. test -n "$sf" && echo -n "-sf $sf "
  32. test -n "$fn" && echo -n "-fn $fn "
  33. }
  34. do_split() {
  35. cut "-d$delim" -f$field
  36. }
  37. dmenu -b -i -l $lines $(style) "$@" | $maybe_split