From b6f2de2212930b2bd97935a00516dd2147421f13 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 21 Sep 2019 19:01:42 -0700 Subject: Added better support for custom asker/picker functionality and simplified some of the things. --- Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f69fdc4..ccc8cec 100644 --- a/Makefile +++ b/Makefile @@ -32,13 +32,20 @@ ifneq (, $(PICKER)) PICKER_FLAG=-D'PICK(prompt, initial)="pick -q \"" initial "\""' endif ifeq ($(shell which $(PICKER)),$(shell which dmenu 2>/dev/null || echo '')) - PICKER_FLAG=-D'PICK(prompt, initial)="dmenu -p \"" prompt "\""' + PICKER_FLAG=-D'PICK(prompt, initial)="dmenu -i -l 10 -p \"" prompt "\""' endif endif CFLAGS += $(PICKER_FLAG) -ifneq (, $(USE_ASK)) - CFLAGS += -D'USE_ASK=1' +ifneq (, $(ASKER)) + ifeq ($(shell which $(ASKER)),$(shell which ask 2>/dev/null || echo '')) + CFLAGS += -D'ASKECHO(prompt, initial)="ask --prompt=\"" prompt "\" --query=\"" initial "\""' + CFLAGS += -D'ASK(var, prompt, initial)=var "=\"$$(ask --prompt=\"" prompt "\" --query=\"" initial "\")\""' + endif + ifeq ($(shell which $(ASKER)),$(shell which dmenu 2>/dev/null || echo '')) + CFLAGS += -D'ASKECHO(prompt, initial)="{ printf \"" initial "\" | dmenu -p \"" prompt "\"; }"' + CFLAGS += -D'ASK(var, prompt, initial)=var "=\"$$(printf \"" initial "\" | dmenu -p \"" prompt "\")\""' + endif endif all: $(NAME) -- cgit v1.2.3