2023-05-09 10:42:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-05-28 11:15:50 +00:00
|
|
|
# Depends on:
|
|
|
|
# - sdcv
|
|
|
|
# - sselp (for selection support)
|
|
|
|
# - lynx (for html support)
|
|
|
|
# invocation: dictpopup [html] [word]
|
|
|
|
# - If no argument provided, the selection is used
|
|
|
|
# - If supplied with the html option, the dictionary output will be piped through lynx
|
|
|
|
# in order to format html as plain text
|
2023-05-09 10:42:03 +00:00
|
|
|
|
2023-05-28 11:15:50 +00:00
|
|
|
# TODO: Switch between dictionaries / dictionary results.
|
|
|
|
# Implementation idea (in C): Store each dictionary entry in an array. Invoke popup with a dictionary entry.
|
|
|
|
# Increment, decrement array and reinvoke or quit according to exit code of popup
|
2023-05-27 19:49:30 +00:00
|
|
|
|
2023-05-28 11:15:50 +00:00
|
|
|
if [ "$1" = "html" ]; then
|
|
|
|
word=${2:-$(sselp)}
|
|
|
|
sdcv -n --utf8-output -e "$word" | format_output |
|
|
|
|
lynx -dump -stdin -assume_charset=UTF-8 -display_charset=UTF-8 |
|
|
|
|
popup
|
|
|
|
else
|
|
|
|
word=${1:-$(sselp)}
|
|
|
|
sdcv -n --utf8-output -e "$word" | format_output | popup
|
|
|
|
fi
|