saturnin-dmenu 1012B

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