diff --git a/Makefile b/Makefile index 5a5285b..d011757 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ clean: dist: clean mkdir -p dmenu-$(VERSION) - cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\ + cp LICENSE Makefile dmenu_run.sh README arg.h config.def.h config.mk dmenu.1\ drw.h util.h stest.1 $(SRC)\ dmenu-$(VERSION) tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION) @@ -33,9 +33,10 @@ dist: clean install: all mkdir -p $(DESTDIR)$(PREFIX)/bin - cp -f dmenu stest $(DESTDIR)$(PREFIX)/bin - chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu + cp -f dmenu dmenu_run.sh stest $(DESTDIR)$(PREFIX)/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/stest + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run.sh + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu mkdir -p $(DESTDIR)$(MANPREFIX)/man1 sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1 @@ -44,8 +45,9 @@ install: all uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ - $(DESTDIR)$(PREFIX)/bin/dmenu_path\ $(DESTDIR)$(PREFIX)/bin/dmenu_run\ + $(DESTDIR)$(PREFIX)/bin/dmenu_run.sh\ + $(DESTDIR)$(PREFIX)/bin/dmenu_path\ $(DESTDIR)$(PREFIX)/bin/stest\ $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\ $(DESTDIR)$(MANPREFIX)/man1/stest.1 diff --git a/dmenu_run.sh b/dmenu_run.sh new file mode 100755 index 0000000..f20b377 --- /dev/null +++ b/dmenu_run.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +FILE="$HOME/.local/share/dmenu_applications.tsv" +if [ ! -f "$FILE" ]; then + echo "File not found: $FILE" >&2 + exit 1 +fi + +sed 's/|/'$'\t''/' "$FILE" | dmenu | { + IFS=$'\t' read -r col1 col2 + [ -z "$col2" ] && exit 0 + eval "$col2" 2>/dev/null || : +}