25 lines
720 B
Plaintext
25 lines
720 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
mkdir -p "${HOME}"/.local/tmp
|
||
|
|
||
|
searchterm=$(zenity --entry --text "Enter word to define" --title "Dictionary" 2> /dev/null);
|
||
|
dict -h localhost -d gcide "${searchterm}" > "${HOME}"/.local/tmp/"${searchterm}".txt 2>&1
|
||
|
|
||
|
content=$(cat "${HOME}"/.local/tmp/"${searchterm}".txt);
|
||
|
|
||
|
if [[ "${content}" == *"No definitions found"* ]]; then
|
||
|
icon=""${HOME}"/.local/bin/img/caution-48.png"
|
||
|
else
|
||
|
icon=""${HOME}"/.local/bin/img/checkmark-32.png"
|
||
|
fi
|
||
|
|
||
|
zenity --text-info \
|
||
|
--window-icon="${icon}" \
|
||
|
--filename="${HOME}"/.local/tmp/"${searchterm}".txt \
|
||
|
--font="IBM Plex Mono Medium 11" \
|
||
|
--width=750 \
|
||
|
--height=600 2> /dev/null
|
||
|
|
||
|
sleep 0.5
|
||
|
rm -rf "${HOME}"/.local/tmp/"${searchterm}".txt
|