~nature/dotfiles

e56d34d0f29016d1f0934cacee3c3bb825a9608b — LordNature 1 year, 9 months ago db8a2ea
bin/fzfmenu: added fzf terminal menu
1 files changed, 24 insertions(+), 0 deletions(-)

A bin/fzfmenu
A bin/fzfmenu => bin/fzfmenu +24 -0
@@ 0,0 1,24 @@
#!/bin/sh
# foot TERM="$TERM -T 'fzfmenu' -w 500x500"
TERM="$TERM -t 'fzfmenu'"
STDIN="$XDG_RUNTIME_DIR/fzfmenu.in"
STDOUT="$XDG_RUNTIME_DIR/fzfmenu.out"
ARGS="$(printf %s "$@" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/")"

if [ -e $STDIN ]; then
	rm -f $STDIN
fi

if [ -e $STDOUT ]; then
	rm -f $STDOUT
fi

mkfifo -m=600 $STDIN
mkfifo -m=600 $STDOUT

nohup $TERM -e sh -c "fzf $ARGS < $STDIN > $STDOUT" > /dev/null 2>&1 & 
trap "kill $! 2>/dev/null; rm -f $STDIN $STDOUT" EXIT

#$STDIN <&0 not sure why this won't work
cat > $STDIN
cat $STDOUT