#!/bin/bash . $(ffoom path) ffoo import inigrep ffoo import pretty usage() { mkusage "[-l|--lines NUM] [--split CHAR] ARGS..." } numbered=false lines=10 maybe_split=cat delim=" " field=2- while true; do case $1 in -l|--lines) lines=$2; shift 2 || usage ;; --split) delim=$2; maybe_split=do_split; shift 2 || usage ;; --split-field) field=$2; maybe_split=do_split; shift 2 || usage ;; --help|--usage) usage ;; *) break ;; esac done nb="$(inigrep -1 -p style.color.nbg)" nf="$(inigrep -1 -p style.color.nfg)" sb="$(inigrep -1 -p style.color.sbg)" sf="$(inigrep -1 -p style.color.sfg)" fn="$(inigrep -1 -p style.font)" fn=${fn:--*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*} debug -v nb nf sb sf fn lines maybe_split delim style() { test -n "$nb" && echo -n "-nb $nb " test -n "$nf" && echo -n "-nf $nf " test -n "$sb" && echo -n "-sb $sb " test -n "$sf" && echo -n "-sf $sf " test -n "$fn" && echo -n "-fn $fn " } do_split() { cut "-d$delim" -f$field } dmenu -b -i -l $lines $(style) "$@" | $maybe_split