From 41a041336e0d1b92b14e92bcccb1e2e78578c129 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Wed, 4 Aug 2021 23:44:43 +0200 Subject: [PATCH] Add a dmenu replacement script Based on https://git.sr.ht/~seirdy/term-dmenu/ --- bin/dmenu | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/dmenu diff --git a/bin/dmenu b/bin/dmenu new file mode 100755 index 0000000..7601e04 --- /dev/null +++ b/bin/dmenu @@ -0,0 +1,23 @@ +#!/bin/bash +# dmenu replacement script based on dmenu-term by Rohan Kumar +# avaiable here : https://git.sr.ht/~seirdy/term-dmenu +# +# Sincer abduco is not packaged on Debian, I rewrite this script to work +# with file redirection and not a named pipe. + +export FZF_DEFAULT_OPTS="$* $FZF_DEFAULT_OPTS" +cleanup() { + rm -f $outfile +} +trap cleanup EXIT +outfile=$(mktemp /tmp/dmenu_XXXXX) +IFS=$(printf '\n') +input=$(cat) +export input +export outfile + +foot -a launcher bash -c \ + 'echo "$(echo "$input" | fzf)" >$outfile 2>/dev/null' 2>/dev/null + +cat <$outfile +# vi:ft=sh