aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2023-10-26 15:50:22 -0400
committertdro <tdro@users.noreply.github.com>2023-10-26 15:50:22 -0400
commite2844ed504369c03b69b1eb9890e6ce15976c071 (patch)
treeb594d7ceb9a00c450ca47921e507119afae1af8c
parentea8be06022749e610367d5ebd8c3fb8d955d6f93 (diff)
downloaddotfiles-e2844ed504369c03b69b1eb9890e6ce15976c071.tar.gz
dotfiles-e2844ed504369c03b69b1eb9890e6ce15976c071.tar.bz2
dotfiles-e2844ed504369c03b69b1eb9890e6ce15976c071.zip
.local/bin/plumber-dmenu: Loop around
-rwxr-xr-x.local/bin/plumber-dmenu20
1 files 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