aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-11-11 22:26:04 +0100
committerAdrian Kummerlaender2016-11-11 22:26:04 +0100
commitcf4ea310724f02aa2d494a7cdfdb22870bd15f7a (patch)
tree52ccbbf27a1939461f22f0f7191ec244cab2b430
parent36dbb259b6af74d4f078a5a717dc70dbcbe502af (diff)
downloaddotfiles-cf4ea310724f02aa2d494a7cdfdb22870bd15f7a.tar
dotfiles-cf4ea310724f02aa2d494a7cdfdb22870bd15f7a.tar.gz
dotfiles-cf4ea310724f02aa2d494a7cdfdb22870bd15f7a.tar.bz2
dotfiles-cf4ea310724f02aa2d494a7cdfdb22870bd15f7a.tar.lz
dotfiles-cf4ea310724f02aa2d494a7cdfdb22870bd15f7a.tar.xz
dotfiles-cf4ea310724f02aa2d494a7cdfdb22870bd15f7a.tar.zst
dotfiles-cf4ea310724f02aa2d494a7cdfdb22870bd15f7a.zip
Add custom `rofi_dict` script
Uses `rofi` to provide an easily accessible dictionary prompt backed by `dict`.
-rwxr-xr-xbin/rofi_dict18
-rw-r--r--pentadactyl/.pentadactylrc2
2 files changed, 19 insertions, 1 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"
diff --git a/pentadactyl/.pentadactylrc b/pentadactyl/.pentadactylrc
index 243fa25..b9e0943 100644
--- a/pentadactyl/.pentadactylrc
+++ b/pentadactyl/.pentadactylrc
@@ -61,7 +61,7 @@ EOF
map -builtin -ex <F8> :reader
map -builtin -ex <F9> :emenu View.Tabbar
-map -builtin -ex <F10> :emenu ScrapBook X.Show in Sidebar
+map -builtin -ex <F10> :sidebar Scrapbook X
nmap b :emenu ScrapBook X.Save Page<CR>
nmap c :cite<CR>