From e2844ed504369c03b69b1eb9890e6ce15976c071 Mon Sep 17 00:00:00 2001 From: tdro Date: Thu, 26 Oct 2023 15:50:22 -0400 Subject: .local/bin/plumber-dmenu: Loop around --- .local/bin/plumber-dmenu | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu index f2aa6b6..ea141c2 100755 --- a/.local/bin/plumber-dmenu +++ b/.local/bin/plumber-dmenu @@ -1,4 +1,5 @@ #!/bin/sh -eu + options="\ case->lower case->title @@ -18,11 +19,14 @@ text->urlize verse->kjv word->dictionary " -printf "%s" "$options" \ - | dmenu -i -b -p ⠀:::⠀plumber⠀::: \ - | while read -r option - do - text=$(plumber --option "$option" --text "$(xsel -o)") - { notify-send "$text" && printf "%s" "$text" | xsel -ib; } \ - || notify-send "Plumber: Clipboard selection is empty" - done + +selection=$( + printf "%s" "$options" | dmenu -i -b -p ⠀:::⠀plumber⠀::: || + { [ "$?" = 127 ] && kill -15 "$$" && "$0"; } +) + +printf "%s\n" "$selection" | while read -r option; do + text=$(plumber --option "$option" --text "$(xsel -o)") + { notify-send "$text" && printf "%s" "$text" | xsel -ib; } || + notify-send "Plumber: Clipboard selection is empty" +done -- cgit v1.2.3