summary refs log tree commit diff
path: root/bin/menu
blob: b3e4759cee8ab5ccf28527156b2451a7dcc67430 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
set -e
[ -n "$DEBUG" ] && set -x

# make sure there we are the only running menu
pgrep bemenu >/dev/null && pkill -f bemenu

# always source the config to make sure
. "$HOME"/.config/bemenu.conf

arg0=bemenu
MENU_PROMPT=${MENU_PROMPT:-󰈶󰩤}

idx=0
while test $# -gt $idx; do
	case "$1" in
	-run)
		arg0=bemenu-run
		MENU_PROMPT="󰏌"
		shift
		;;
	-drun)
		arg0="j4-dmenu-desktop --dmenu=bemenu"
		MENU_PROMPT="󱂬"
		shift
		;;
	-p)
		shift
		MENU_PROMPT="$1"
		shift
		;;
	-x)
		shift
		BEMENU_OPTS="${BEMENU_OPTS} --password"
		;;
	esac
	idx=$((idx + 1))
done

[ -n "${MENU_POPUP}" ] &&
	BEMENU_OPTS="${BEMENU_OPTS} --center --width-factor 0.5 --border 2 --list 8" # --fixed-height

BEMENU_OPTS="${BEMENU_OPTS} --prompt ${MENU_PROMPT}"

BEMENU_OPTS="${BEMENU_OPTS} $*"

exec ${arg0}