#!/bin/sh
# dmenu, as this node's launcher answers it (module rofi, novox/hq ADR 0208). The node-launcher
# seat's dmenu-compatible command: choices on standard input, the chosen one on standard output,
# exit 1 when nothing was chosen. A script calls `dmenu` and works whichever module holds the seat.
#
# rofi understands dmenu's -p, -l and -i. dmenu's look options (-fn, -nb, -nf, -sb, -sf, -m, -w)
# take a value rofi would misread, so they are dropped with it; -b and -f are dropped alone. The
# look is the launcher's theme.
set -u
n=$#
while [ "$n" -gt 0 ]; do
	arg=$1
	shift
	n=$((n - 1))
	case $arg in
	-fn | -nb | -nf | -sb | -sf | -m | -w)
		if [ "$n" -gt 0 ]; then
			shift
			n=$((n - 1))
		fi
		;;
	-b | -f) ;;
	*) set -- "$@" "$arg" ;;
	esac
done
exec rofi -dmenu "$@"
