aboutsummaryrefslogtreecommitdiff
path: root/bin/rofi_dict
diff options
context:
space:
mode:
Diffstat (limited to 'bin/rofi_dict')
-rwxr-xr-xbin/rofi_dict18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/rofi_dict b/bin/rofi_dict
new file mode 100755
index 0000000..4124754
--- /dev/null
+++ b/bin/rofi_dict
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+terminal="urxvtc -title dictionary -borderwidth 10 -e"
+tmpfile="/tmp/ddict.lookup.$$"
+word=$(cat /usr/share/dict/words | rofi -dmenu -p 'dict:')
+
+while [[ $word != "" ]]; do
+ result=$(dict "$word" 2>&1)
+
+ if [[ $? -eq 21 ]]; then
+ word=$(echo -e "$result" | cut -d: -f2 | xargs -n1 | sort -u -f | rofi -dmenu -p 'similar:')
+ else
+ echo -e "$result" > "$tmpfile"
+ break
+ fi
+done
+
+$terminal less "$tmpfile"