aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2020-11-23 02:31:56 -0500
committertdro <tdro@users.noreply.github.com>2020-11-23 02:31:56 -0500
commit33fe558b164c7de6aae7dc85382d8404f274b952 (patch)
tree88e402f82372edfbb5ae0da72e02fad4b43fbfe8 /.local
parentf52e3543ace4dd512750006631940f77885e1bc4 (diff)
downloaddotfiles-33fe558b164c7de6aae7dc85382d8404f274b952.tar.gz
dotfiles-33fe558b164c7de6aae7dc85382d8404f274b952.tar.bz2
dotfiles-33fe558b164c7de6aae7dc85382d8404f274b952.zip
.local/bin/plumber-dmenu: Reduce start up time
Go back to predefining options
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/plumber18
-rwxr-xr-x.local/bin/plumber-dmenu9
2 files changed, 11 insertions, 16 deletions
diff --git a/.local/bin/plumber b/.local/bin/plumber
index 71a19ad..74a51b1 100755
--- a/.local/bin/plumber
+++ b/.local/bin/plumber
@@ -6,31 +6,21 @@ defmodule ArgParser do
System.argv()
|> OptionParser.parse!(strict: [option: :string, text: :string])
- options = [
- "First letter of each word in sentence", #0
- "Single line of text", #1
- "Thesaurus", #2
- "KJV Verse Lookup" #3
- ]
-
cond do
- opts[:option] == options |> Enum.at(0) ->
+ opts[:option] == "First letter of each word in sentence" ->
TextPlumber.firstLetterOfWordsIn(opts[:text]) |> IO.binwrite()
- opts[:option] == options |> Enum.at(1) ->
+ opts[:option] == "Single line of text" ->
TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite()
- opts[:option] == options |> Enum.at(2) ->
+ opts[:option] == "Thesaurus" ->
TextPlumber.synonymOfFirstWordIn(opts[:text])
TextPlumber.firstWordOf(opts[:text]) |> IO.binwrite()
- opts[:option] == options |> Enum.at(3) ->
+ opts[:option] == "KJV Verse Lookup" ->
System.cmd("urxvt", ["-e", "sh", "-c", "kjv #{TextPlumber.singleLineOf(opts[:text])}"])
TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite()
- opts[:option] == "list" ->
- Enum.map(options, fn option -> IO.puts(option) end)
-
true ->
"No plumber #{opts[:option] || "specified"}." |> IO.puts()
end
diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu
index 46dae74..d7ece41 100755
--- a/.local/bin/plumber-dmenu
+++ b/.local/bin/plumber-dmenu
@@ -1,6 +1,11 @@
#!/bin/sh -eu
-plumber --option list \
- | dmenu -i -b \
+options="First letter of each word in sentence
+Single line of text
+Thesaurus
+KJV Verse Lookup
+"
+printf "%s" "$options" \
+ | dmenu -i -b -p Plumb \
| while read -r option
do
text=$(plumber --option "$option" --text "$(xsel -o)")