From d224f3c208395ebb4b8da3e98d48038cb20fc3e9 Mon Sep 17 00:00:00 2001 From: John Gebbie Date: Sun, 12 Mar 2023 09:55:03 +0000 Subject: [PATCH] phrases: support $NUMEN_DMENU and $DMENU --- phrases/voice.phrases | 4 ++-- phrasescripts/transcripts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/phrases/voice.phrases b/phrases/voice.phrases index c10f211..9ef4e84 100644 --- a/phrases/voice.phrases +++ b/phrases/voice.phrases @@ -49,8 +49,8 @@ nevermind:localeval awk -v n=${#NUMEN_TEXT} 'BEGIN {for(;n--;) print "press Back initial:localeval awk -v n=${#NUMEN_TEXT} 'BEGIN {for(;n--;) print "press Left"}' # Menu of transcription results -# (Requires the dmenu command) +# (Requires the dmenu command or $NUMEN_DMENU or $DMENU) transcripts:eval /usr/libexec/numen/phrases/transcripts "$fmt" & # Menu to change transcription result -# (Requires the dmenu command) +# (Requires the dmenu command or $NUMEN_DMENU or $DMENU) change:eval /usr/libexec/numen/phrases/transcripts "$fmt" change & diff --git a/phrasescripts/transcripts b/phrasescripts/transcripts index 4201157..e0228d3 100755 --- a/phrasescripts/transcripts +++ b/phrasescripts/transcripts @@ -1,12 +1,14 @@ #!/bin/sh # transcripts FORMAT [CHANGE] +dmenu="${NUMEN_DMENU:-"${DMENU:-dmenu}"}" +dmenu_opts="${NUMEN_DMENU_OPTS:--i -l 10}" export DISPLAY="$(/usr/libexec/numen/phrases/displaying)" f="${XDG_DATA_HOME:-$HOME/.local/share}/numen/transcripts" if [ "$2" ]; then if [ "$(wc -l < "$f")" -gt 1 ]; then - if transcript="$(tail -n +2 "$f" | /usr/libexec/numen/phrases/fmt "$1" | dmenu -i -l 10)"; then + if transcript="$(tail -n +2 "$f" | /usr/libexec/numen/phrases/fmt "$1" | "$dmenu" $dmenu_opts)"; then awk -v n=${#NUMEN_TEXT} 'BEGIN {for(;n--;) print "press BackSpace"}' printf 'type %s\n' "$transcript" fi @@ -14,7 +16,7 @@ if [ "$2" ]; then notify-send 'No alternative transcripts' & fi elif [ -s "$f" ]; then - printf 'type %s\n' "$(/usr/libexec/numen/phrases/fmt "$1" < "$f" | dmenu -i -l 10)" + printf 'type %s\n' "$(/usr/libexec/numen/phrases/fmt "$1" < "$f" | "$dmenu" $dmenu_opts)" else notify-send 'No transcripts' & fi -- 2.38.5